Add generated client
This commit is contained in:
21
client/.gitignore
vendored
Normal file
21
client/.gitignore
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# exclude jar for gradle wrapper
|
||||||
|
!gradle/wrapper/*.jar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
# build files
|
||||||
|
**/target
|
||||||
|
target
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
23
client/.swagger-codegen-ignore
Normal file
23
client/.swagger-codegen-ignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
||||||
1
client/.swagger-codegen/VERSION
Normal file
1
client/.swagger-codegen/VERSION
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2.3.1
|
||||||
17
client/.travis.yml
Normal file
17
client/.travis.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- oraclejdk8
|
||||||
|
- oraclejdk7
|
||||||
|
before_install:
|
||||||
|
# ensure gradlew has proper permission
|
||||||
|
- chmod a+x ./gradlew
|
||||||
|
script:
|
||||||
|
# test using maven
|
||||||
|
- mvn test
|
||||||
|
# uncomment below to test using gradle
|
||||||
|
# - gradle test
|
||||||
|
# uncomment below to test using sbt
|
||||||
|
# - sbt test
|
||||||
183
client/README.md
Normal file
183
client/README.md
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
# swagger-java-client
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install the API client library to your local Maven repository, simply execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn install
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||||
|
|
||||||
|
### Maven users
|
||||||
|
|
||||||
|
Add this dependency to your project's POM:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-java-client</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gradle users
|
||||||
|
|
||||||
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
compile "io.swagger:swagger-java-client:1.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
At first generate the JAR by executing:
|
||||||
|
|
||||||
|
mvn package
|
||||||
|
|
||||||
|
Then manually install the following JARs:
|
||||||
|
|
||||||
|
* target/swagger-java-client-1.0.0.jar
|
||||||
|
* target/lib/*.jar
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
import com.github.gotify.client.*;
|
||||||
|
import com.github.gotify.client.auth.*;
|
||||||
|
import com.github.gotify.client.model.*;
|
||||||
|
import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class MessageApiExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure API key authorization: appTokenHeader
|
||||||
|
ApiKeyAuth appTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("appTokenHeader");
|
||||||
|
appTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//appTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: appTokenQuery
|
||||||
|
ApiKeyAuth appTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("appTokenQuery");
|
||||||
|
appTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//appTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Message body = new Message(); // Message | the message to add
|
||||||
|
try {
|
||||||
|
Message result = apiInstance.createMessage(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#createMessage");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*MessageApi* | [**createMessage**](docs/MessageApi.md#createMessage) | **POST** /message | Create a message.
|
||||||
|
*MessageApi* | [**deleteAppMessages**](docs/MessageApi.md#deleteAppMessages) | **DELETE** /application/{id}/message | Delete all messages from a specific application.
|
||||||
|
*MessageApi* | [**deleteMessage**](docs/MessageApi.md#deleteMessage) | **DELETE** /message/{id} | Deletes a message with an id.
|
||||||
|
*MessageApi* | [**deleteMessages**](docs/MessageApi.md#deleteMessages) | **DELETE** /message | Delete all messages.
|
||||||
|
*MessageApi* | [**getAppMessages**](docs/MessageApi.md#getAppMessages) | **GET** /application/{id}/message | Return all messages from a specific application.
|
||||||
|
*MessageApi* | [**getMessages**](docs/MessageApi.md#getMessages) | **GET** /message | Return all messages.
|
||||||
|
*MessageApi* | [**streamMessages**](docs/MessageApi.md#streamMessages) | **GET** /stream | Websocket, return newly created messages.
|
||||||
|
*TokenApi* | [**createApp**](docs/TokenApi.md#createApp) | **POST** /application | Create an application.
|
||||||
|
*TokenApi* | [**createClient**](docs/TokenApi.md#createClient) | **POST** /client | Create a client.
|
||||||
|
*TokenApi* | [**deleteApp**](docs/TokenApi.md#deleteApp) | **DELETE** /application/{id} | Delete an application.
|
||||||
|
*TokenApi* | [**deleteClient**](docs/TokenApi.md#deleteClient) | **DELETE** /client/{id} | Delete a client.
|
||||||
|
*TokenApi* | [**getApps**](docs/TokenApi.md#getApps) | **GET** /application | Return all applications.
|
||||||
|
*TokenApi* | [**getClients**](docs/TokenApi.md#getClients) | **GET** /client | Return all clients.
|
||||||
|
*TokenApi* | [**uploadAppImage**](docs/TokenApi.md#uploadAppImage) | **POST** /application/{id}/image |
|
||||||
|
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create a user.
|
||||||
|
*UserApi* | [**currentUser**](docs/UserApi.md#currentUser) | **GET** /current/user | Return the current user.
|
||||||
|
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{id} | Deletes a user.
|
||||||
|
*UserApi* | [**getUser**](docs/UserApi.md#getUser) | **GET** /user/{id} | Get a user.
|
||||||
|
*UserApi* | [**getUsers**](docs/UserApi.md#getUsers) | **GET** /user | Return all users.
|
||||||
|
*UserApi* | [**updateCurrentUser**](docs/UserApi.md#updateCurrentUser) | **POST** /current/user/password | Update the password of the current user.
|
||||||
|
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **POST** /user/{id} | Update a user.
|
||||||
|
*VersionApi* | [**getVersion**](docs/VersionApi.md#getVersion) | **GET** /version | Get version information.
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [Application](docs/Application.md)
|
||||||
|
- [Client](docs/Client.md)
|
||||||
|
- [Error](docs/Error.md)
|
||||||
|
- [Message](docs/Message.md)
|
||||||
|
- [PagedMessages](docs/PagedMessages.md)
|
||||||
|
- [Paging](docs/Paging.md)
|
||||||
|
- [User](docs/User.md)
|
||||||
|
- [UserPass](docs/UserPass.md)
|
||||||
|
- [UserWithPass](docs/UserWithPass.md)
|
||||||
|
- [VersionInfo](docs/VersionInfo.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
Authentication schemes defined for the API:
|
||||||
|
### appTokenHeader
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: X-Gotify-Key
|
||||||
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### appTokenQuery
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: token
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
|
### basicAuth
|
||||||
|
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
|
||||||
|
### clientTokenHeader
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: X-Gotify-Key
|
||||||
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### clientTokenQuery
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: token
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
104
client/build.gradle
Normal file
104
client/build.gradle
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = 'io.swagger'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||||
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(hasProperty('target') && target == 'android') {
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.2'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 25
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_7
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
provided 'javax.annotation:jsr250-api:1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
android.libraryVariants.all { variant ->
|
||||||
|
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||||
|
task.description = "Create jar artifact for ${variant.name}"
|
||||||
|
task.dependsOn variant.javaCompile
|
||||||
|
task.from variant.javaCompile.destinationDir
|
||||||
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
|
artifacts.add('archives', task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = 'swagger-java-client'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'io.swagger:swagger-annotations:1.5.15'
|
||||||
|
compile 'com.squareup.okhttp:okhttp:2.7.5'
|
||||||
|
compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
|
||||||
|
compile 'com.google.code.gson:gson:2.8.1'
|
||||||
|
compile 'io.gsonfire:gson-fire:1.8.0'
|
||||||
|
compile 'org.threeten:threetenbp:1.3.5'
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
}
|
||||||
21
client/build.sbt
Normal file
21
client/build.sbt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
lazy val root = (project in file(".")).
|
||||||
|
settings(
|
||||||
|
organization := "io.swagger",
|
||||||
|
name := "swagger-java-client",
|
||||||
|
version := "1.0.0",
|
||||||
|
scalaVersion := "2.11.4",
|
||||||
|
scalacOptions ++= Seq("-feature"),
|
||||||
|
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
||||||
|
publishArtifact in (Compile, packageDoc) := false,
|
||||||
|
resolvers += Resolver.mavenLocal,
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"io.swagger" % "swagger-annotations" % "1.5.15",
|
||||||
|
"com.squareup.okhttp" % "okhttp" % "2.7.5",
|
||||||
|
"com.squareup.okhttp" % "logging-interceptor" % "2.7.5",
|
||||||
|
"com.google.code.gson" % "gson" % "2.8.1",
|
||||||
|
"org.threeten" % "threetenbp" % "1.3.5" % "compile",
|
||||||
|
"io.gsonfire" % "gson-fire" % "1.8.0" % "compile",
|
||||||
|
"junit" % "junit" % "4.12" % "test",
|
||||||
|
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||||
|
)
|
||||||
|
)
|
||||||
14
client/docs/Application.md
Normal file
14
client/docs/Application.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
# Application
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**description** | **String** | The description of the application. |
|
||||||
|
**id** | **Integer** | The application id. |
|
||||||
|
**image** | **String** | The image of the application. |
|
||||||
|
**name** | **String** | The application name. This is how the application should be displayed to the user. |
|
||||||
|
**token** | **String** | The application token. Can be used as `appToken`. See Authentication. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
12
client/docs/Client.md
Normal file
12
client/docs/Client.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# Client
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer** | The client id. |
|
||||||
|
**name** | **String** | The client name. This is how the client should be displayed to the user. |
|
||||||
|
**token** | **String** | The client token. Can be used as `clientToken`. See Authentication. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
12
client/docs/Error.md
Normal file
12
client/docs/Error.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# Error
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**error** | **String** | The general error message |
|
||||||
|
**errorCode** | **Long** | The http error code. |
|
||||||
|
**errorDescription** | **String** | The http error code. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
15
client/docs/Message.md
Normal file
15
client/docs/Message.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# Message
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**appid** | **Integer** | The application id that send this message. |
|
||||||
|
**date** | [**OffsetDateTime**](OffsetDateTime.md) | The date the message was created. |
|
||||||
|
**id** | **Integer** | The message id. |
|
||||||
|
**message** | **String** | The actual message. |
|
||||||
|
**priority** | **Long** | The priority of the message. | [optional]
|
||||||
|
**title** | **String** | The title of the message. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
455
client/docs/MessageApi.md
Normal file
455
client/docs/MessageApi.md
Normal file
@@ -0,0 +1,455 @@
|
|||||||
|
# MessageApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**createMessage**](MessageApi.md#createMessage) | **POST** /message | Create a message.
|
||||||
|
[**deleteAppMessages**](MessageApi.md#deleteAppMessages) | **DELETE** /application/{id}/message | Delete all messages from a specific application.
|
||||||
|
[**deleteMessage**](MessageApi.md#deleteMessage) | **DELETE** /message/{id} | Deletes a message with an id.
|
||||||
|
[**deleteMessages**](MessageApi.md#deleteMessages) | **DELETE** /message | Delete all messages.
|
||||||
|
[**getAppMessages**](MessageApi.md#getAppMessages) | **GET** /application/{id}/message | Return all messages from a specific application.
|
||||||
|
[**getMessages**](MessageApi.md#getMessages) | **GET** /message | Return all messages.
|
||||||
|
[**streamMessages**](MessageApi.md#streamMessages) | **GET** /stream | Websocket, return newly created messages.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="createMessage"></a>
|
||||||
|
# **createMessage**
|
||||||
|
> Message createMessage(body)
|
||||||
|
|
||||||
|
Create a message.
|
||||||
|
|
||||||
|
__NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure API key authorization: appTokenHeader
|
||||||
|
ApiKeyAuth appTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("appTokenHeader");
|
||||||
|
appTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//appTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: appTokenQuery
|
||||||
|
ApiKeyAuth appTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("appTokenQuery");
|
||||||
|
appTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//appTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Message body = new Message(); // Message | the message to add
|
||||||
|
try {
|
||||||
|
Message result = apiInstance.createMessage(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#createMessage");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**Message**](Message.md)| the message to add |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Message**](Message.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[appTokenHeader](../README.md#appTokenHeader), [appTokenQuery](../README.md#appTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteAppMessages"></a>
|
||||||
|
# **deleteAppMessages**
|
||||||
|
> deleteAppMessages(id)
|
||||||
|
|
||||||
|
Delete all messages from a specific application.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Integer id = 56; // Integer | the application id
|
||||||
|
try {
|
||||||
|
apiInstance.deleteAppMessages(id);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#deleteAppMessages");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the application id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteMessage"></a>
|
||||||
|
# **deleteMessage**
|
||||||
|
> deleteMessage(id)
|
||||||
|
|
||||||
|
Deletes a message with an id.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Integer id = 56; // Integer | the message id
|
||||||
|
try {
|
||||||
|
apiInstance.deleteMessage(id);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#deleteMessage");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the message id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteMessages"></a>
|
||||||
|
# **deleteMessages**
|
||||||
|
> deleteMessages()
|
||||||
|
|
||||||
|
Delete all messages.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
try {
|
||||||
|
apiInstance.deleteMessages();
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#deleteMessages");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getAppMessages"></a>
|
||||||
|
# **getAppMessages**
|
||||||
|
> PagedMessages getAppMessages(id, limit, since)
|
||||||
|
|
||||||
|
Return all messages from a specific application.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Integer id = 56; // Integer | the application id
|
||||||
|
Integer limit = 100; // Integer | the maximal amount of messages to return
|
||||||
|
Integer since = 56; // Integer | return all messages with an ID less than this value
|
||||||
|
try {
|
||||||
|
PagedMessages result = apiInstance.getAppMessages(id, limit, since);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#getAppMessages");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the application id |
|
||||||
|
**limit** | **Integer**| the maximal amount of messages to return | [optional] [default to 100]
|
||||||
|
**since** | **Integer**| return all messages with an ID less than this value | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**PagedMessages**](PagedMessages.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getMessages"></a>
|
||||||
|
# **getMessages**
|
||||||
|
> PagedMessages getMessages(limit, since)
|
||||||
|
|
||||||
|
Return all messages.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
Integer limit = 100; // Integer | the maximal amount of messages to return
|
||||||
|
Integer since = 56; // Integer | return all messages with an ID less than this value
|
||||||
|
try {
|
||||||
|
PagedMessages result = apiInstance.getMessages(limit, since);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#getMessages");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**limit** | **Integer**| the maximal amount of messages to return | [optional] [default to 100]
|
||||||
|
**since** | **Integer**| return all messages with an ID less than this value | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**PagedMessages**](PagedMessages.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="streamMessages"></a>
|
||||||
|
# **streamMessages**
|
||||||
|
> Message streamMessages()
|
||||||
|
|
||||||
|
Websocket, return newly created messages.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.MessageApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
MessageApi apiInstance = new MessageApi();
|
||||||
|
try {
|
||||||
|
Message result = apiInstance.streamMessages();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling MessageApi#streamMessages");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Message**](Message.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
11
client/docs/PagedMessages.md
Normal file
11
client/docs/PagedMessages.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# PagedMessages
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**messages** | [**List<Message>**](Message.md) | The messages. |
|
||||||
|
**paging** | [**Paging**](Paging.md) | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
13
client/docs/Paging.md
Normal file
13
client/docs/Paging.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
# Paging
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**limit** | **Long** | The limit of the messages for the current request. |
|
||||||
|
**next** | **String** | The request url for the next page. Empty/Null when no next page is available. | [optional]
|
||||||
|
**since** | **Integer** | The ID of the last message returned in the current request. Use this as alternative to the next link. |
|
||||||
|
**size** | **Long** | The amount of messages that got returned in the current request. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
457
client/docs/TokenApi.md
Normal file
457
client/docs/TokenApi.md
Normal file
@@ -0,0 +1,457 @@
|
|||||||
|
# TokenApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**createApp**](TokenApi.md#createApp) | **POST** /application | Create an application.
|
||||||
|
[**createClient**](TokenApi.md#createClient) | **POST** /client | Create a client.
|
||||||
|
[**deleteApp**](TokenApi.md#deleteApp) | **DELETE** /application/{id} | Delete an application.
|
||||||
|
[**deleteClient**](TokenApi.md#deleteClient) | **DELETE** /client/{id} | Delete a client.
|
||||||
|
[**getApps**](TokenApi.md#getApps) | **GET** /application | Return all applications.
|
||||||
|
[**getClients**](TokenApi.md#getClients) | **GET** /client | Return all clients.
|
||||||
|
[**uploadAppImage**](TokenApi.md#uploadAppImage) | **POST** /application/{id}/image |
|
||||||
|
|
||||||
|
|
||||||
|
<a name="createApp"></a>
|
||||||
|
# **createApp**
|
||||||
|
> Application createApp(body)
|
||||||
|
|
||||||
|
Create an application.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
Application body = new Application(); // Application | the application to add
|
||||||
|
try {
|
||||||
|
Application result = apiInstance.createApp(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#createApp");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**Application**](Application.md)| the application to add |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Application**](Application.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="createClient"></a>
|
||||||
|
# **createClient**
|
||||||
|
> Client createClient(body)
|
||||||
|
|
||||||
|
Create a client.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
Client body = new Client(); // Client | the client to add
|
||||||
|
try {
|
||||||
|
Client result = apiInstance.createClient(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#createClient");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**Client**](Client.md)| the client to add |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Client**](Client.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteApp"></a>
|
||||||
|
# **deleteApp**
|
||||||
|
> deleteApp(id)
|
||||||
|
|
||||||
|
Delete an application.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
Integer id = 56; // Integer | the application id
|
||||||
|
try {
|
||||||
|
apiInstance.deleteApp(id);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#deleteApp");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the application id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteClient"></a>
|
||||||
|
# **deleteClient**
|
||||||
|
> deleteClient(id)
|
||||||
|
|
||||||
|
Delete a client.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
Integer id = 56; // Integer | the client id
|
||||||
|
try {
|
||||||
|
apiInstance.deleteClient(id);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#deleteClient");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the client id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getApps"></a>
|
||||||
|
# **getApps**
|
||||||
|
> List<Application> getApps()
|
||||||
|
|
||||||
|
Return all applications.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
try {
|
||||||
|
List<Application> result = apiInstance.getApps();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#getApps");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<Application>**](Application.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getClients"></a>
|
||||||
|
# **getClients**
|
||||||
|
> List<Client> getClients()
|
||||||
|
|
||||||
|
Return all clients.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
try {
|
||||||
|
List<Client> result = apiInstance.getClients();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#getClients");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<Client>**](Client.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="uploadAppImage"></a>
|
||||||
|
# **uploadAppImage**
|
||||||
|
> Application uploadAppImage(file, id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Upload an image for an application
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.TokenApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
TokenApi apiInstance = new TokenApi();
|
||||||
|
File file = new File("/path/to/file.txt"); // File | the application image
|
||||||
|
Integer id = 56; // Integer | the application id
|
||||||
|
try {
|
||||||
|
Application result = apiInstance.uploadAppImage(file, id);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling TokenApi#uploadAppImage");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**file** | **File**| the application image |
|
||||||
|
**id** | **Integer**| the application id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Application**](Application.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
12
client/docs/User.md
Normal file
12
client/docs/User.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# User
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**admin** | **Boolean** | If the user is an administrator. | [optional]
|
||||||
|
**id** | **Integer** | The user id. |
|
||||||
|
**name** | **String** | The user name. For login. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
455
client/docs/UserApi.md
Normal file
455
client/docs/UserApi.md
Normal file
@@ -0,0 +1,455 @@
|
|||||||
|
# UserApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**createUser**](UserApi.md#createUser) | **POST** /user | Create a user.
|
||||||
|
[**currentUser**](UserApi.md#currentUser) | **GET** /current/user | Return the current user.
|
||||||
|
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{id} | Deletes a user.
|
||||||
|
[**getUser**](UserApi.md#getUser) | **GET** /user/{id} | Get a user.
|
||||||
|
[**getUsers**](UserApi.md#getUsers) | **GET** /user | Return all users.
|
||||||
|
[**updateCurrentUser**](UserApi.md#updateCurrentUser) | **POST** /current/user/password | Update the password of the current user.
|
||||||
|
[**updateUser**](UserApi.md#updateUser) | **POST** /user/{id} | Update a user.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="createUser"></a>
|
||||||
|
# **createUser**
|
||||||
|
> User createUser(body)
|
||||||
|
|
||||||
|
Create a user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
UserWithPass body = new UserWithPass(); // UserWithPass | the user to add
|
||||||
|
try {
|
||||||
|
User result = apiInstance.createUser(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#createUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**UserWithPass**](UserWithPass.md)| the user to add |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="currentUser"></a>
|
||||||
|
# **currentUser**
|
||||||
|
> User currentUser()
|
||||||
|
|
||||||
|
Return the current user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
try {
|
||||||
|
User result = apiInstance.currentUser();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#currentUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="deleteUser"></a>
|
||||||
|
# **deleteUser**
|
||||||
|
> deleteUser(id)
|
||||||
|
|
||||||
|
Deletes a user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
Integer id = 56; // Integer | the user id
|
||||||
|
try {
|
||||||
|
apiInstance.deleteUser(id);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#deleteUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the user id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getUser"></a>
|
||||||
|
# **getUser**
|
||||||
|
> User getUser(id)
|
||||||
|
|
||||||
|
Get a user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
Integer id = 56; // Integer | the user id
|
||||||
|
try {
|
||||||
|
User result = apiInstance.getUser(id);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#getUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the user id |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="getUsers"></a>
|
||||||
|
# **getUsers**
|
||||||
|
> List<User> getUsers()
|
||||||
|
|
||||||
|
Return all users.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
try {
|
||||||
|
List<User> result = apiInstance.getUsers();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#getUsers");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<User>**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="updateCurrentUser"></a>
|
||||||
|
# **updateCurrentUser**
|
||||||
|
> updateCurrentUser(body)
|
||||||
|
|
||||||
|
Update the password of the current user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
UserPass body = new UserPass(); // UserPass | the user
|
||||||
|
try {
|
||||||
|
apiInstance.updateCurrentUser(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#updateCurrentUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**UserPass**](UserPass.md)| the user |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a name="updateUser"></a>
|
||||||
|
# **updateUser**
|
||||||
|
> User updateUser(id, body)
|
||||||
|
|
||||||
|
Update a user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiClient;
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.Configuration;
|
||||||
|
//import com.github.gotify.client.auth.*;
|
||||||
|
//import com.github.gotify.client.api.UserApi;
|
||||||
|
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
|
||||||
|
// Configure HTTP basic authorization: basicAuth
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
|
||||||
|
basicAuth.setUsername("YOUR USERNAME");
|
||||||
|
basicAuth.setPassword("YOUR PASSWORD");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenHeader
|
||||||
|
ApiKeyAuth clientTokenHeader = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenHeader");
|
||||||
|
clientTokenHeader.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenHeader.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
// Configure API key authorization: clientTokenQuery
|
||||||
|
ApiKeyAuth clientTokenQuery = (ApiKeyAuth) defaultClient.getAuthentication("clientTokenQuery");
|
||||||
|
clientTokenQuery.setApiKey("YOUR API KEY");
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//clientTokenQuery.setApiKeyPrefix("Token");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi();
|
||||||
|
Integer id = 56; // Integer | the user id
|
||||||
|
UserWithPass body = new UserWithPass(); // UserWithPass | the updated user
|
||||||
|
try {
|
||||||
|
User result = apiInstance.updateUser(id, body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#updateUser");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**id** | **Integer**| the user id |
|
||||||
|
**body** | [**UserWithPass**](UserWithPass.md)| the updated user |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[basicAuth](../README.md#basicAuth), [clientTokenHeader](../README.md#clientTokenHeader), [clientTokenQuery](../README.md#clientTokenQuery)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
10
client/docs/UserPass.md
Normal file
10
client/docs/UserPass.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
# UserPass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**pass** | **String** | The user password. For login. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
13
client/docs/UserWithPass.md
Normal file
13
client/docs/UserWithPass.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
# UserWithPass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**admin** | **Boolean** | If the user is an administrator. | [optional]
|
||||||
|
**id** | **Integer** | The user id. |
|
||||||
|
**name** | **String** | The user name. For login. |
|
||||||
|
**pass** | **String** | The user password. For login. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
48
client/docs/VersionApi.md
Normal file
48
client/docs/VersionApi.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# VersionApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**getVersion**](VersionApi.md#getVersion) | **GET** /version | Get version information.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="getVersion"></a>
|
||||||
|
# **getVersion**
|
||||||
|
> VersionInfo getVersion()
|
||||||
|
|
||||||
|
Get version information.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
//import com.github.gotify.client.ApiException;
|
||||||
|
//import com.github.gotify.client.api.VersionApi;
|
||||||
|
|
||||||
|
|
||||||
|
VersionApi apiInstance = new VersionApi();
|
||||||
|
try {
|
||||||
|
VersionInfo result = apiInstance.getVersion();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling VersionApi#getVersion");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**VersionInfo**](VersionInfo.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
12
client/docs/VersionInfo.md
Normal file
12
client/docs/VersionInfo.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# VersionInfo
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**buildDate** | **String** | The date on which this binary was built. |
|
||||||
|
**commit** | **String** | The git commit hash on which this binary was built. |
|
||||||
|
**version** | **String** | The current version. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
52
client/git_push.sh
Normal file
52
client/git_push.sh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
2
client/gradle.properties
Normal file
2
client/gradle.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Uncomment to build for Android
|
||||||
|
#target = android
|
||||||
BIN
client/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
client/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
client/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
client/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Tue May 17 23:08:05 CST 2016
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
|
||||||
160
client/gradlew
vendored
Normal file
160
client/gradlew
vendored
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||||
90
client/gradlew.bat
vendored
Normal file
90
client/gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
@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
|
||||||
|
|
||||||
|
@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=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
242
client/pom.xml
Normal file
242
client/pom.xml
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-java-client</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>swagger-java-client</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||||
|
<description>Swagger Java</description>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||||
|
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>Unlicense</name>
|
||||||
|
<url>https://github.com/gotify/server/blob/master/LICENSE</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>Swagger</name>
|
||||||
|
<email>apiteam@swagger.io</email>
|
||||||
|
<organization>Swagger</organization>
|
||||||
|
<organizationUrl>http://swagger.io</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
<version>3.0.0-M1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>enforce-maven</id>
|
||||||
|
<goals>
|
||||||
|
<goal>enforce</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<requireMavenVersion>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</requireMavenVersion>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
<configuration>
|
||||||
|
<systemProperties>
|
||||||
|
<property>
|
||||||
|
<name>loggerPath</name>
|
||||||
|
<value>conf/log4j.properties</value>
|
||||||
|
</property>
|
||||||
|
</systemProperties>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<forkMode>pertest</forkMode>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>1.10</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add_sources</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
src/main/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add_test_sources</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-test-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
src/test/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.10.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>${okhttp-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
|
<artifactId>logging-interceptor</artifactId>
|
||||||
|
<version>${okhttp-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>${gson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.gsonfire</groupId>
|
||||||
|
<artifactId>gson-fire</artifactId>
|
||||||
|
<version>${gson-fire-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.threeten</groupId>
|
||||||
|
<artifactId>threetenbp</artifactId>
|
||||||
|
<version>${threetenbp-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.7</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<gson-fire-version>1.8.0</gson-fire-version>
|
||||||
|
<swagger-core-version>1.5.15</swagger-core-version>
|
||||||
|
<okhttp-version>2.7.5</okhttp-version>
|
||||||
|
<gson-version>2.8.1</gson-version>
|
||||||
|
<threetenbp-version>1.3.5</threetenbp-version>
|
||||||
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
<junit-version>4.12</junit-version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
1
client/settings.gradle
Normal file
1
client/settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "swagger-java-client"
|
||||||
3
client/src/main/AndroidManifest.xml
Normal file
3
client/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="com.github.gotify.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for asynchronous API call.
|
||||||
|
*
|
||||||
|
* @param <T> The return type
|
||||||
|
*/
|
||||||
|
public interface ApiCallback<T> {
|
||||||
|
/**
|
||||||
|
* This is called when the API call fails.
|
||||||
|
*
|
||||||
|
* @param e The exception causing the failure
|
||||||
|
* @param statusCode Status code of the response if available, otherwise it would be 0
|
||||||
|
* @param responseHeaders Headers of the response if available, otherwise it would be null
|
||||||
|
*/
|
||||||
|
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the API call succeeded.
|
||||||
|
*
|
||||||
|
* @param result The result deserialized from response
|
||||||
|
* @param statusCode Status code of the response
|
||||||
|
* @param responseHeaders Headers of the response
|
||||||
|
*/
|
||||||
|
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the API upload processing.
|
||||||
|
*
|
||||||
|
* @param bytesWritten bytes Written
|
||||||
|
* @param contentLength content length of request body
|
||||||
|
* @param done write end
|
||||||
|
*/
|
||||||
|
void onUploadProgress(long bytesWritten, long contentLength, boolean done);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the API downlond processing.
|
||||||
|
*
|
||||||
|
* @param bytesRead bytes Read
|
||||||
|
* @param contentLength content lenngth of the response
|
||||||
|
* @param done Read end
|
||||||
|
*/
|
||||||
|
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
|
||||||
|
}
|
||||||
1210
client/src/main/java/com/github/gotify/client/ApiClient.java
Normal file
1210
client/src/main/java/com/github/gotify/client/ApiClient.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class ApiException extends Exception {
|
||||||
|
private int code = 0;
|
||||||
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
|
private String responseBody = null;
|
||||||
|
|
||||||
|
public ApiException() {}
|
||||||
|
|
||||||
|
public ApiException(Throwable throwable) {
|
||||||
|
super(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
super(message, throwable);
|
||||||
|
this.code = code;
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
|
this(message, throwable, code, responseHeaders, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this(code, message);
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP status code.
|
||||||
|
*
|
||||||
|
* @return HTTP status code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response headers.
|
||||||
|
*
|
||||||
|
* @return A map of list of string
|
||||||
|
*/
|
||||||
|
public Map<String, List<String>> getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response body.
|
||||||
|
*
|
||||||
|
* @return Response body in the form of string
|
||||||
|
*/
|
||||||
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API response returned by API call.
|
||||||
|
*
|
||||||
|
* @param <T> The type of data that is deserialized from response body
|
||||||
|
*/
|
||||||
|
public class ApiResponse<T> {
|
||||||
|
final private int statusCode;
|
||||||
|
final private Map<String, List<String>> headers;
|
||||||
|
final private T data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param statusCode The status code of HTTP response
|
||||||
|
* @param headers The headers of HTTP response
|
||||||
|
*/
|
||||||
|
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
|
||||||
|
this(statusCode, headers, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param statusCode The status code of HTTP response
|
||||||
|
* @param headers The headers of HTTP response
|
||||||
|
* @param data The object deserialized from response bod
|
||||||
|
*/
|
||||||
|
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
this.headers = headers;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, List<String>> getHeaders() {
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Configuration {
|
||||||
|
private static ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default API client, which would be used when creating API
|
||||||
|
* instances without providing an API client.
|
||||||
|
*
|
||||||
|
* @return Default API client
|
||||||
|
*/
|
||||||
|
public static ApiClient getDefaultApiClient() {
|
||||||
|
return defaultApiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default API client, which would be used when creating API
|
||||||
|
* instances without providing an API client.
|
||||||
|
*
|
||||||
|
* @param apiClient API client
|
||||||
|
*/
|
||||||
|
public static void setDefaultApiClient(ApiClient apiClient) {
|
||||||
|
defaultApiClient = apiClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.*;
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSink;
|
||||||
|
import okio.GzipSink;
|
||||||
|
import okio.Okio;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes request bodies using gzip.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/square/okhttp/issues/350
|
||||||
|
*/
|
||||||
|
class GzipRequestInterceptor implements Interceptor {
|
||||||
|
@Override public Response intercept(Chain chain) throws IOException {
|
||||||
|
Request originalRequest = chain.request();
|
||||||
|
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
|
||||||
|
return chain.proceed(originalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request compressedRequest = originalRequest.newBuilder()
|
||||||
|
.header("Content-Encoding", "gzip")
|
||||||
|
.method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
|
||||||
|
.build();
|
||||||
|
return chain.proceed(compressedRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody forceContentLength(final RequestBody requestBody) throws IOException {
|
||||||
|
final Buffer buffer = new Buffer();
|
||||||
|
requestBody.writeTo(buffer);
|
||||||
|
return new RequestBody() {
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return requestBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() {
|
||||||
|
return buffer.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
sink.write(buffer.snapshot());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody gzip(final RequestBody body) {
|
||||||
|
return new RequestBody() {
|
||||||
|
@Override public MediaType contentType() {
|
||||||
|
return body.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public long contentLength() {
|
||||||
|
return -1; // We don't know the compressed length in advance!
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
|
||||||
|
body.writeTo(gzipSink);
|
||||||
|
gzipSink.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
362
client/src/main/java/com/github/gotify/client/JSON.java
Normal file
362
client/src/main/java/com/github/gotify/client/JSON.java
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.internal.bind.util.ISO8601Utils;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import io.gsonfire.GsonFireBuilder;
|
||||||
|
import io.gsonfire.TypeSelector;
|
||||||
|
import org.threeten.bp.LocalDate;
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
|
import org.threeten.bp.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import com.github.gotify.client.model.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.ParsePosition;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class JSON {
|
||||||
|
private Gson gson;
|
||||||
|
private boolean isLenientOnJson = false;
|
||||||
|
private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
|
||||||
|
private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
|
||||||
|
private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
|
||||||
|
private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
|
||||||
|
|
||||||
|
public static GsonBuilder createGson() {
|
||||||
|
GsonFireBuilder fireBuilder = new GsonFireBuilder()
|
||||||
|
;
|
||||||
|
return fireBuilder.createGsonBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
|
||||||
|
JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
|
||||||
|
if(null == element) {
|
||||||
|
throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
|
||||||
|
}
|
||||||
|
return element.getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
|
||||||
|
Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase());
|
||||||
|
if(null == clazz) {
|
||||||
|
throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
|
||||||
|
}
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON() {
|
||||||
|
gson = createGson()
|
||||||
|
.registerTypeAdapter(Date.class, dateTypeAdapter)
|
||||||
|
.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
|
||||||
|
.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
|
||||||
|
.registerTypeAdapter(LocalDate.class, localDateTypeAdapter)
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Gson.
|
||||||
|
*
|
||||||
|
* @return Gson
|
||||||
|
*/
|
||||||
|
public Gson getGson() {
|
||||||
|
return gson;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Gson.
|
||||||
|
*
|
||||||
|
* @param gson Gson
|
||||||
|
* @return JSON
|
||||||
|
*/
|
||||||
|
public JSON setGson(Gson gson) {
|
||||||
|
this.gson = gson;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON setLenientOnJson(boolean lenientOnJson) {
|
||||||
|
isLenientOnJson = lenientOnJson;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the given Java object into JSON string.
|
||||||
|
*
|
||||||
|
* @param obj Object
|
||||||
|
* @return String representation of the JSON
|
||||||
|
*/
|
||||||
|
public String serialize(Object obj) {
|
||||||
|
return gson.toJson(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize the given JSON string to Java object.
|
||||||
|
*
|
||||||
|
* @param <T> Type
|
||||||
|
* @param body The JSON string
|
||||||
|
* @param returnType The type to deserialize into
|
||||||
|
* @return The deserialized Java object
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T deserialize(String body, Type returnType) {
|
||||||
|
try {
|
||||||
|
if (isLenientOnJson) {
|
||||||
|
JsonReader jsonReader = new JsonReader(new StringReader(body));
|
||||||
|
// see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean)
|
||||||
|
jsonReader.setLenient(true);
|
||||||
|
return gson.fromJson(jsonReader, returnType);
|
||||||
|
} else {
|
||||||
|
return gson.fromJson(body, returnType);
|
||||||
|
}
|
||||||
|
} catch (JsonParseException e) {
|
||||||
|
// Fallback processing when failed to parse JSON form response body:
|
||||||
|
// return the response body string directly for the String return type;
|
||||||
|
if (returnType.equals(String.class))
|
||||||
|
return (T) body;
|
||||||
|
else throw (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gson TypeAdapter for JSR310 OffsetDateTime type
|
||||||
|
*/
|
||||||
|
public static class OffsetDateTimeTypeAdapter extends TypeAdapter<OffsetDateTime> {
|
||||||
|
|
||||||
|
private DateTimeFormatter formatter;
|
||||||
|
|
||||||
|
public OffsetDateTimeTypeAdapter() {
|
||||||
|
this(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) {
|
||||||
|
this.formatter = formatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormat(DateTimeFormatter dateFormat) {
|
||||||
|
this.formatter = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter out, OffsetDateTime date) throws IOException {
|
||||||
|
if (date == null) {
|
||||||
|
out.nullValue();
|
||||||
|
} else {
|
||||||
|
out.value(formatter.format(date));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OffsetDateTime read(JsonReader in) throws IOException {
|
||||||
|
switch (in.peek()) {
|
||||||
|
case NULL:
|
||||||
|
in.nextNull();
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
String date = in.nextString();
|
||||||
|
if (date.endsWith("+0000")) {
|
||||||
|
date = date.substring(0, date.length()-5) + "Z";
|
||||||
|
}
|
||||||
|
return OffsetDateTime.parse(date, formatter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gson TypeAdapter for JSR310 LocalDate type
|
||||||
|
*/
|
||||||
|
public class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
|
||||||
|
|
||||||
|
private DateTimeFormatter formatter;
|
||||||
|
|
||||||
|
public LocalDateTypeAdapter() {
|
||||||
|
this(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTypeAdapter(DateTimeFormatter formatter) {
|
||||||
|
this.formatter = formatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormat(DateTimeFormatter dateFormat) {
|
||||||
|
this.formatter = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter out, LocalDate date) throws IOException {
|
||||||
|
if (date == null) {
|
||||||
|
out.nullValue();
|
||||||
|
} else {
|
||||||
|
out.value(formatter.format(date));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDate read(JsonReader in) throws IOException {
|
||||||
|
switch (in.peek()) {
|
||||||
|
case NULL:
|
||||||
|
in.nextNull();
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
String date = in.nextString();
|
||||||
|
return LocalDate.parse(date, formatter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
|
offsetDateTimeTypeAdapter.setFormat(dateFormat);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
|
localDateTypeAdapter.setFormat(dateFormat);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gson TypeAdapter for java.sql.Date type
|
||||||
|
* If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
|
||||||
|
* (more efficient than SimpleDateFormat).
|
||||||
|
*/
|
||||||
|
public static class SqlDateTypeAdapter extends TypeAdapter<java.sql.Date> {
|
||||||
|
|
||||||
|
private DateFormat dateFormat;
|
||||||
|
|
||||||
|
public SqlDateTypeAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqlDateTypeAdapter(DateFormat dateFormat) {
|
||||||
|
this.dateFormat = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormat(DateFormat dateFormat) {
|
||||||
|
this.dateFormat = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter out, java.sql.Date date) throws IOException {
|
||||||
|
if (date == null) {
|
||||||
|
out.nullValue();
|
||||||
|
} else {
|
||||||
|
String value;
|
||||||
|
if (dateFormat != null) {
|
||||||
|
value = dateFormat.format(date);
|
||||||
|
} else {
|
||||||
|
value = date.toString();
|
||||||
|
}
|
||||||
|
out.value(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public java.sql.Date read(JsonReader in) throws IOException {
|
||||||
|
switch (in.peek()) {
|
||||||
|
case NULL:
|
||||||
|
in.nextNull();
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
String date = in.nextString();
|
||||||
|
try {
|
||||||
|
if (dateFormat != null) {
|
||||||
|
return new java.sql.Date(dateFormat.parse(date).getTime());
|
||||||
|
}
|
||||||
|
return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new JsonParseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gson TypeAdapter for java.util.Date type
|
||||||
|
* If the dateFormat is null, ISO8601Utils will be used.
|
||||||
|
*/
|
||||||
|
public static class DateTypeAdapter extends TypeAdapter<Date> {
|
||||||
|
|
||||||
|
private DateFormat dateFormat;
|
||||||
|
|
||||||
|
public DateTypeAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTypeAdapter(DateFormat dateFormat) {
|
||||||
|
this.dateFormat = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormat(DateFormat dateFormat) {
|
||||||
|
this.dateFormat = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter out, Date date) throws IOException {
|
||||||
|
if (date == null) {
|
||||||
|
out.nullValue();
|
||||||
|
} else {
|
||||||
|
String value;
|
||||||
|
if (dateFormat != null) {
|
||||||
|
value = dateFormat.format(date);
|
||||||
|
} else {
|
||||||
|
value = ISO8601Utils.format(date, true);
|
||||||
|
}
|
||||||
|
out.value(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date read(JsonReader in) throws IOException {
|
||||||
|
try {
|
||||||
|
switch (in.peek()) {
|
||||||
|
case NULL:
|
||||||
|
in.nextNull();
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
String date = in.nextString();
|
||||||
|
try {
|
||||||
|
if (dateFormat != null) {
|
||||||
|
return dateFormat.parse(date);
|
||||||
|
}
|
||||||
|
return ISO8601Utils.parse(date, new ParsePosition(0));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new JsonParseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new JsonParseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON setDateFormat(DateFormat dateFormat) {
|
||||||
|
dateTypeAdapter.setFormat(dateFormat);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSON setSqlDateFormat(DateFormat dateFormat) {
|
||||||
|
sqlDateTypeAdapter.setFormat(dateFormat);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
52
client/src/main/java/com/github/gotify/client/Pair.java
Normal file
52
client/src/main/java/com/github/gotify/client/Pair.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Pair {
|
||||||
|
private String name = "";
|
||||||
|
private String value = "";
|
||||||
|
|
||||||
|
public Pair (String name, String value) {
|
||||||
|
setName(name);
|
||||||
|
setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setName(String name) {
|
||||||
|
if (!isValidString(name)) return;
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setValue(String value) {
|
||||||
|
if (!isValidString(value)) return;
|
||||||
|
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidString(String arg) {
|
||||||
|
if (arg == null) return false;
|
||||||
|
if (arg.trim().isEmpty()) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.MediaType;
|
||||||
|
import com.squareup.okhttp.RequestBody;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSink;
|
||||||
|
import okio.ForwardingSink;
|
||||||
|
import okio.Okio;
|
||||||
|
import okio.Sink;
|
||||||
|
|
||||||
|
public class ProgressRequestBody extends RequestBody {
|
||||||
|
|
||||||
|
public interface ProgressRequestListener {
|
||||||
|
void onRequestProgress(long bytesWritten, long contentLength, boolean done);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RequestBody requestBody;
|
||||||
|
|
||||||
|
private final ProgressRequestListener progressListener;
|
||||||
|
|
||||||
|
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
|
||||||
|
this.requestBody = requestBody;
|
||||||
|
this.progressListener = progressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return requestBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() throws IOException {
|
||||||
|
return requestBody.contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
BufferedSink bufferedSink = Okio.buffer(sink(sink));
|
||||||
|
requestBody.writeTo(bufferedSink);
|
||||||
|
bufferedSink.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Sink sink(Sink sink) {
|
||||||
|
return new ForwardingSink(sink) {
|
||||||
|
|
||||||
|
long bytesWritten = 0L;
|
||||||
|
long contentLength = 0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(Buffer source, long byteCount) throws IOException {
|
||||||
|
super.write(source, byteCount);
|
||||||
|
if (contentLength == 0) {
|
||||||
|
contentLength = contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
bytesWritten += byteCount;
|
||||||
|
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.MediaType;
|
||||||
|
import com.squareup.okhttp.ResponseBody;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSource;
|
||||||
|
import okio.ForwardingSource;
|
||||||
|
import okio.Okio;
|
||||||
|
import okio.Source;
|
||||||
|
|
||||||
|
public class ProgressResponseBody extends ResponseBody {
|
||||||
|
|
||||||
|
public interface ProgressListener {
|
||||||
|
void update(long bytesRead, long contentLength, boolean done);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ResponseBody responseBody;
|
||||||
|
private final ProgressListener progressListener;
|
||||||
|
private BufferedSource bufferedSource;
|
||||||
|
|
||||||
|
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
this.progressListener = progressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return responseBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() throws IOException {
|
||||||
|
return responseBody.contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BufferedSource source() throws IOException {
|
||||||
|
if (bufferedSource == null) {
|
||||||
|
bufferedSource = Okio.buffer(source(responseBody.source()));
|
||||||
|
}
|
||||||
|
return bufferedSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Source source(Source source) {
|
||||||
|
return new ForwardingSource(source) {
|
||||||
|
long totalBytesRead = 0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long read(Buffer sink, long byteCount) throws IOException {
|
||||||
|
long bytesRead = super.read(sink, byteCount);
|
||||||
|
// read() returns the number of bytes read, or -1 if this source is exhausted.
|
||||||
|
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
|
||||||
|
progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
|
||||||
|
return bytesRead;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class StringUtil {
|
||||||
|
/**
|
||||||
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
*
|
||||||
|
* @param array The array
|
||||||
|
* @param value The value to search
|
||||||
|
* @return true if the array contains the value
|
||||||
|
*/
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) return true;
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join an array of strings with the given separator.
|
||||||
|
* <p>
|
||||||
|
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||||
|
* if one of those libraries is added as dependency.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param array The array of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) return "";
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,901 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiCallback;
|
||||||
|
import com.github.gotify.client.ApiClient;
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.ApiResponse;
|
||||||
|
import com.github.gotify.client.Configuration;
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
import com.github.gotify.client.ProgressRequestBody;
|
||||||
|
import com.github.gotify.client.ProgressResponseBody;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import com.github.gotify.client.model.Message;
|
||||||
|
import com.github.gotify.client.model.PagedMessages;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MessageApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public MessageApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build call for createMessage
|
||||||
|
* @param body the message to add (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createMessageCall(Message body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/message";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "appTokenHeader", "appTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call createMessageValidateBeforeCall(Message body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling createMessage(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createMessageCall(body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a message.
|
||||||
|
* __NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
|
* @param body the message to add (required)
|
||||||
|
* @return Message
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public Message createMessage(Message body) throws ApiException {
|
||||||
|
ApiResponse<Message> resp = createMessageWithHttpInfo(body);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a message.
|
||||||
|
* __NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
|
* @param body the message to add (required)
|
||||||
|
* @return ApiResponse<Message>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Message> createMessageWithHttpInfo(Message body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = createMessageValidateBeforeCall(body, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<Message>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a message. (asynchronously)
|
||||||
|
* __NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
|
* @param body the message to add (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createMessageAsync(Message body, final ApiCallback<Message> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createMessageValidateBeforeCall(body, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<Message>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteAppMessages
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteAppMessagesCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application/{id}/message"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteAppMessagesValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling deleteAppMessages(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteAppMessagesCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages from a specific application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteAppMessages(Integer id) throws ApiException {
|
||||||
|
deleteAppMessagesWithHttpInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages from a specific application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteAppMessagesWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteAppMessagesValidateBeforeCall(id, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages from a specific application. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteAppMessagesAsync(Integer id, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteAppMessagesValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteMessage
|
||||||
|
* @param id the message id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteMessageCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/message/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteMessageValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling deleteMessage(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteMessageCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a message with an id.
|
||||||
|
*
|
||||||
|
* @param id the message id (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteMessage(Integer id) throws ApiException {
|
||||||
|
deleteMessageWithHttpInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a message with an id.
|
||||||
|
*
|
||||||
|
* @param id the message id (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteMessageWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteMessageValidateBeforeCall(id, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a message with an id. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the message id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteMessageAsync(Integer id, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteMessageValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteMessages
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteMessagesCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/message";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteMessagesValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteMessagesCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages.
|
||||||
|
*
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteMessages() throws ApiException {
|
||||||
|
deleteMessagesWithHttpInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteMessagesWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteMessagesValidateBeforeCall(null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteMessagesAsync(final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteMessagesValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getAppMessages
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getAppMessagesCall(Integer id, Integer limit, Integer since, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application/{id}/message"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
if (limit != null)
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
|
||||||
|
if (since != null)
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("since", since));
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getAppMessagesValidateBeforeCall(Integer id, Integer limit, Integer since, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling getAppMessages(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getAppMessagesCall(id, limit, since, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages from a specific application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @return PagedMessages
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public PagedMessages getAppMessages(Integer id, Integer limit, Integer since) throws ApiException {
|
||||||
|
ApiResponse<PagedMessages> resp = getAppMessagesWithHttpInfo(id, limit, since);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages from a specific application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @return ApiResponse<PagedMessages>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<PagedMessages> getAppMessagesWithHttpInfo(Integer id, Integer limit, Integer since) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getAppMessagesValidateBeforeCall(id, limit, since, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<PagedMessages>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages from a specific application. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getAppMessagesAsync(Integer id, Integer limit, Integer since, final ApiCallback<PagedMessages> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getAppMessagesValidateBeforeCall(id, limit, since, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<PagedMessages>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getMessages
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getMessagesCall(Integer limit, Integer since, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/message";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
if (limit != null)
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
|
||||||
|
if (since != null)
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("since", since));
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getMessagesValidateBeforeCall(Integer limit, Integer since, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getMessagesCall(limit, since, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages.
|
||||||
|
*
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @return PagedMessages
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public PagedMessages getMessages(Integer limit, Integer since) throws ApiException {
|
||||||
|
ApiResponse<PagedMessages> resp = getMessagesWithHttpInfo(limit, since);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages.
|
||||||
|
*
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @return ApiResponse<PagedMessages>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<PagedMessages> getMessagesWithHttpInfo(Integer limit, Integer since) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(limit, since, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<PagedMessages>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param limit the maximal amount of messages to return (optional, default to 100)
|
||||||
|
* @param since return all messages with an ID less than this value (optional)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getMessagesAsync(Integer limit, Integer since, final ApiCallback<PagedMessages> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(limit, since, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<PagedMessages>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for streamMessages
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call streamMessagesCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/stream";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call streamMessagesValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = streamMessagesCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket, return newly created messages.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public Message streamMessages() throws ApiException {
|
||||||
|
ApiResponse<Message> resp = streamMessagesWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket, return newly created messages.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<Message>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Message> streamMessagesWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = streamMessagesValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<Message>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket, return newly created messages. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call streamMessagesAsync(final ApiCallback<Message> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = streamMessagesValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<Message>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
}
|
||||||
902
client/src/main/java/com/github/gotify/client/api/TokenApi.java
Normal file
902
client/src/main/java/com/github/gotify/client/api/TokenApi.java
Normal file
@@ -0,0 +1,902 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiCallback;
|
||||||
|
import com.github.gotify.client.ApiClient;
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.ApiResponse;
|
||||||
|
import com.github.gotify.client.Configuration;
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
import com.github.gotify.client.ProgressRequestBody;
|
||||||
|
import com.github.gotify.client.ProgressResponseBody;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.gotify.client.model.Application;
|
||||||
|
import com.github.gotify.client.model.Client;
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TokenApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public TokenApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build call for createApp
|
||||||
|
* @param body the application to add (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createAppCall(Application body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call createAppValidateBeforeCall(Application body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling createApp(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createAppCall(body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an application.
|
||||||
|
*
|
||||||
|
* @param body the application to add (required)
|
||||||
|
* @return Application
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public Application createApp(Application body) throws ApiException {
|
||||||
|
ApiResponse<Application> resp = createAppWithHttpInfo(body);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an application.
|
||||||
|
*
|
||||||
|
* @param body the application to add (required)
|
||||||
|
* @return ApiResponse<Application>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Application> createAppWithHttpInfo(Application body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = createAppValidateBeforeCall(body, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<Application>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an application. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param body the application to add (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createAppAsync(Application body, final ApiCallback<Application> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createAppValidateBeforeCall(body, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<Application>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for createClient
|
||||||
|
* @param body the client to add (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createClientCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/client";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call createClientValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling createClient(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createClientCall(body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a client.
|
||||||
|
*
|
||||||
|
* @param body the client to add (required)
|
||||||
|
* @return Client
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public Client createClient(Client body) throws ApiException {
|
||||||
|
ApiResponse<Client> resp = createClientWithHttpInfo(body);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a client.
|
||||||
|
*
|
||||||
|
* @param body the client to add (required)
|
||||||
|
* @return ApiResponse<Client>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Client> createClientWithHttpInfo(Client body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = createClientValidateBeforeCall(body, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<Client>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a client. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param body the client to add (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createClientAsync(Client body, final ApiCallback<Client> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createClientValidateBeforeCall(body, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<Client>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteApp
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteAppCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteAppValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling deleteApp(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteAppCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteApp(Integer id) throws ApiException {
|
||||||
|
deleteAppWithHttpInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an application.
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteAppWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteAppValidateBeforeCall(id, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an application. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteAppAsync(Integer id, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteAppValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteClient
|
||||||
|
* @param id the client id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteClientCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/client/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteClientValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling deleteClient(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteClientCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a client.
|
||||||
|
*
|
||||||
|
* @param id the client id (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteClient(Integer id) throws ApiException {
|
||||||
|
deleteClientWithHttpInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a client.
|
||||||
|
*
|
||||||
|
* @param id the client id (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteClientWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteClientValidateBeforeCall(id, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a client. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the client id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteClientAsync(Integer id, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteClientValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getApps
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getAppsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getAppsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getAppsCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all applications.
|
||||||
|
*
|
||||||
|
* @return List<Application>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public List<Application> getApps() throws ApiException {
|
||||||
|
ApiResponse<List<Application>> resp = getAppsWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all applications.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<List<Application>>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<List<Application>> getAppsWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getAppsValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<List<Application>>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all applications. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getAppsAsync(final ApiCallback<List<Application>> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getAppsValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<List<Application>>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getClients
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getClientsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/client";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getClientsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getClientsCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all clients.
|
||||||
|
*
|
||||||
|
* @return List<Client>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public List<Client> getClients() throws ApiException {
|
||||||
|
ApiResponse<List<Client>> resp = getClientsWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all clients.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<List<Client>>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<List<Client>> getClientsWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getClientsValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<List<Client>>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all clients. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getClientsAsync(final ApiCallback<List<Client>> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getClientsValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<List<Client>>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for uploadAppImage
|
||||||
|
* @param file the application image (required)
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call uploadAppImageCall(File file, Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/application/{id}/image"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
if (file != null)
|
||||||
|
localVarFormParams.put("file", file);
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"multipart/form-data"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call uploadAppImageValidateBeforeCall(File file, Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'file' is set
|
||||||
|
if (file == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'file' when calling uploadAppImage(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling uploadAppImage(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = uploadAppImageCall(file, id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Upload an image for an application
|
||||||
|
* @param file the application image (required)
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @return Application
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public Application uploadAppImage(File file, Integer id) throws ApiException {
|
||||||
|
ApiResponse<Application> resp = uploadAppImageWithHttpInfo(file, id);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Upload an image for an application
|
||||||
|
* @param file the application image (required)
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @return ApiResponse<Application>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Application> uploadAppImageWithHttpInfo(File file, Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = uploadAppImageValidateBeforeCall(file, id, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<Application>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (asynchronously)
|
||||||
|
* Upload an image for an application
|
||||||
|
* @param file the application image (required)
|
||||||
|
* @param id the application id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call uploadAppImageAsync(File file, Integer id, final ApiCallback<Application> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = uploadAppImageValidateBeforeCall(file, id, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<Application>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
}
|
||||||
900
client/src/main/java/com/github/gotify/client/api/UserApi.java
Normal file
900
client/src/main/java/com/github/gotify/client/api/UserApi.java
Normal file
@@ -0,0 +1,900 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiCallback;
|
||||||
|
import com.github.gotify.client.ApiClient;
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.ApiResponse;
|
||||||
|
import com.github.gotify.client.Configuration;
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
import com.github.gotify.client.ProgressRequestBody;
|
||||||
|
import com.github.gotify.client.ProgressResponseBody;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import com.github.gotify.client.model.User;
|
||||||
|
import com.github.gotify.client.model.UserPass;
|
||||||
|
import com.github.gotify.client.model.UserWithPass;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class UserApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public UserApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build call for createUser
|
||||||
|
* @param body the user to add (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createUserCall(UserWithPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/user";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call createUserValidateBeforeCall(UserWithPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createUserCall(body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a user.
|
||||||
|
*
|
||||||
|
* @param body the user to add (required)
|
||||||
|
* @return User
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public User createUser(UserWithPass body) throws ApiException {
|
||||||
|
ApiResponse<User> resp = createUserWithHttpInfo(body);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a user.
|
||||||
|
*
|
||||||
|
* @param body the user to add (required)
|
||||||
|
* @return ApiResponse<User>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<User> createUserWithHttpInfo(UserWithPass body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param body the user to add (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call createUserAsync(UserWithPass body, final ApiCallback<User> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for currentUser
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call currentUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/current/user";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call currentUserValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = currentUserCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current user.
|
||||||
|
*
|
||||||
|
* @return User
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public User currentUser() throws ApiException {
|
||||||
|
ApiResponse<User> resp = currentUserWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current user.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<User>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<User> currentUserWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = currentUserValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call currentUserAsync(final ApiCallback<User> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = currentUserValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for deleteUser
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteUserCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/user/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call deleteUserValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling deleteUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteUserCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void deleteUser(Integer id) throws ApiException {
|
||||||
|
deleteUserWithHttpInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> deleteUserWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(id, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call deleteUserAsync(Integer id, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getUser
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getUserCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/user/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getUserValidateBeforeCall(Integer id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling getUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getUserCall(id, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @return User
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public User getUser(Integer id) throws ApiException {
|
||||||
|
ApiResponse<User> resp = getUserWithHttpInfo(id);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @return ApiResponse<User>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<User> getUserWithHttpInfo(Integer id) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getUserValidateBeforeCall(id, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getUserAsync(Integer id, final ApiCallback<User> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getUserValidateBeforeCall(id, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for getUsers
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getUsersCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/user";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getUsersValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getUsersCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all users.
|
||||||
|
*
|
||||||
|
* @return List<User>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public List<User> getUsers() throws ApiException {
|
||||||
|
ApiResponse<List<User>> resp = getUsersWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all users.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<List<User>>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<List<User>> getUsersWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<List<User>>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all users. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getUsersAsync(final ApiCallback<List<User>> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<List<User>>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for updateCurrentUser
|
||||||
|
* @param body the user (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call updateCurrentUserCall(UserPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/current/user/password";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call updateCurrentUserValidateBeforeCall(UserPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling updateCurrentUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = updateCurrentUserCall(body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the password of the current user.
|
||||||
|
*
|
||||||
|
* @param body the user (required)
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public void updateCurrentUser(UserPass body) throws ApiException {
|
||||||
|
updateCurrentUserWithHttpInfo(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the password of the current user.
|
||||||
|
*
|
||||||
|
* @param body the user (required)
|
||||||
|
* @return ApiResponse<Void>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<Void> updateCurrentUserWithHttpInfo(UserPass body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = updateCurrentUserValidateBeforeCall(body, null, null);
|
||||||
|
return apiClient.execute(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the password of the current user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param body the user (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call updateCurrentUserAsync(UserPass body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = updateCurrentUserValidateBeforeCall(body, progressListener, progressRequestListener);
|
||||||
|
apiClient.executeAsync(call, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Build call for updateUser
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param body the updated user (required)
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call updateUserCall(Integer id, UserWithPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/user/{id}"
|
||||||
|
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { "basicAuth", "clientTokenHeader", "clientTokenQuery" };
|
||||||
|
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call updateUserValidateBeforeCall(Integer id, UserWithPass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
// verify the required parameter 'id' is set
|
||||||
|
if (id == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'id' when calling updateUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = updateUserCall(id, body, progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param body the updated user (required)
|
||||||
|
* @return User
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public User updateUser(Integer id, UserWithPass body) throws ApiException {
|
||||||
|
ApiResponse<User> resp = updateUserWithHttpInfo(id, body);
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a user.
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param body the updated user (required)
|
||||||
|
* @return ApiResponse<User>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<User> updateUserWithHttpInfo(Integer id, UserWithPass body) throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = updateUserValidateBeforeCall(id, body, null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a user. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param id the user id (required)
|
||||||
|
* @param body the updated user (required)
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call updateUserAsync(Integer id, UserWithPass body, final ApiCallback<User> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = updateUserValidateBeforeCall(id, body, progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<User>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiCallback;
|
||||||
|
import com.github.gotify.client.ApiClient;
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.ApiResponse;
|
||||||
|
import com.github.gotify.client.Configuration;
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
import com.github.gotify.client.ProgressRequestBody;
|
||||||
|
import com.github.gotify.client.ProgressResponseBody;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.gotify.client.model.VersionInfo;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class VersionApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public VersionApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersionApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build call for getVersion
|
||||||
|
* @param progressListener Progress listener
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getVersionCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/version";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||||
|
@Override
|
||||||
|
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||||
|
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private com.squareup.okhttp.Call getVersionValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getVersionCall(progressListener, progressRequestListener);
|
||||||
|
return call;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version information.
|
||||||
|
*
|
||||||
|
* @return VersionInfo
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public VersionInfo getVersion() throws ApiException {
|
||||||
|
ApiResponse<VersionInfo> resp = getVersionWithHttpInfo();
|
||||||
|
return resp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version information.
|
||||||
|
*
|
||||||
|
* @return ApiResponse<VersionInfo>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
*/
|
||||||
|
public ApiResponse<VersionInfo> getVersionWithHttpInfo() throws ApiException {
|
||||||
|
com.squareup.okhttp.Call call = getVersionValidateBeforeCall(null, null);
|
||||||
|
Type localVarReturnType = new TypeToken<VersionInfo>(){}.getType();
|
||||||
|
return apiClient.execute(call, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version information. (asynchronously)
|
||||||
|
*
|
||||||
|
* @param callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
*/
|
||||||
|
public com.squareup.okhttp.Call getVersionAsync(final ApiCallback<VersionInfo> callback) throws ApiException {
|
||||||
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
com.squareup.okhttp.Call call = getVersionValidateBeforeCall(progressListener, progressRequestListener);
|
||||||
|
Type localVarReturnType = new TypeToken<VersionInfo>(){}.getType();
|
||||||
|
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.auth;
|
||||||
|
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class ApiKeyAuth implements Authentication {
|
||||||
|
private final String location;
|
||||||
|
private final String paramName;
|
||||||
|
|
||||||
|
private String apiKey;
|
||||||
|
private String apiKeyPrefix;
|
||||||
|
|
||||||
|
public ApiKeyAuth(String location, String paramName) {
|
||||||
|
this.location = location;
|
||||||
|
this.paramName = paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamName() {
|
||||||
|
return paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKey() {
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKeyPrefix() {
|
||||||
|
return apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||||
|
this.apiKeyPrefix = apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String value;
|
||||||
|
if (apiKeyPrefix != null) {
|
||||||
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
} else {
|
||||||
|
value = apiKey;
|
||||||
|
}
|
||||||
|
if ("query".equals(location)) {
|
||||||
|
queryParams.add(new Pair(paramName, value));
|
||||||
|
} else if ("header".equals(location)) {
|
||||||
|
headerParams.put(paramName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.auth;
|
||||||
|
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface Authentication {
|
||||||
|
/**
|
||||||
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param queryParams List of query parameters
|
||||||
|
* @param headerParams Map of header parameters
|
||||||
|
*/
|
||||||
|
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.auth;
|
||||||
|
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.Credentials;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
public class HttpBasicAuth implements Authentication {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
headerParams.put("Authorization", Credentials.basic(
|
||||||
|
username == null ? "" : username,
|
||||||
|
password == null ? "" : password));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.auth;
|
||||||
|
|
||||||
|
import com.github.gotify.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class OAuth implements Authentication {
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (accessToken != null) {
|
||||||
|
headerParams.put("Authorization", "Bearer " + accessToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.auth;
|
||||||
|
|
||||||
|
public enum OAuthFlow {
|
||||||
|
accessCode, implicit, password, application
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Application holds information about an app which can send notifications.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Application holds information about an app which can send notifications.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Application {
|
||||||
|
@SerializedName("description")
|
||||||
|
private String description = null;
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id = null;
|
||||||
|
|
||||||
|
@SerializedName("image")
|
||||||
|
private String image = null;
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
@SerializedName("token")
|
||||||
|
private String token = null;
|
||||||
|
|
||||||
|
public Application description(String description) {
|
||||||
|
this.description = description;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of the application.
|
||||||
|
* @return description
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Backup server for the interwebs", required = true, value = "The description of the application.")
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application id.
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5", required = true, value = "The application id.")
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The image of the application.
|
||||||
|
* @return image
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "https://example.com/image.jpeg", required = true, value = "The image of the application.")
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Application name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application name. This is how the application should be displayed to the user.
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Backup Server", required = true, value = "The application name. This is how the application should be displayed to the user.")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application token. Can be used as `appToken`. See Authentication.
|
||||||
|
* @return token
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "AWH0wZ5r0Mbac.r", required = true, value = "The application token. Can be used as `appToken`. See Authentication.")
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Application application = (Application) o;
|
||||||
|
return Objects.equals(this.description, application.description) &&
|
||||||
|
Objects.equals(this.id, application.id) &&
|
||||||
|
Objects.equals(this.image, application.image) &&
|
||||||
|
Objects.equals(this.name, application.name) &&
|
||||||
|
Objects.equals(this.token, application.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(description, id, image, name, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Application {\n");
|
||||||
|
|
||||||
|
sb.append(" description: ").append(toIndentedString(description)).append("\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" image: ").append(toIndentedString(image)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append(" token: ").append(toIndentedString(token)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
122
client/src/main/java/com/github/gotify/client/model/Client.java
Normal file
122
client/src/main/java/com/github/gotify/client/model/Client.java
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Client holds information about a device which can receive notifications (and other stuff).
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Client holds information about a device which can receive notifications (and other stuff).")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Client {
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id = null;
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
@SerializedName("token")
|
||||||
|
private String token = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client id.
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5", required = true, value = "The client id.")
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Client name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client name. This is how the client should be displayed to the user.
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Android Phone", required = true, value = "The client name. This is how the client should be displayed to the user.")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client token. Can be used as `clientToken`. See Authentication.
|
||||||
|
* @return token
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "CWH0wZ5r0Mbac.r", required = true, value = "The client token. Can be used as `clientToken`. See Authentication.")
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Client client = (Client) o;
|
||||||
|
return Objects.equals(this.id, client.id) &&
|
||||||
|
Objects.equals(this.name, client.name) &&
|
||||||
|
Objects.equals(this.token, client.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Client {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append(" token: ").append(toIndentedString(token)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
140
client/src/main/java/com/github/gotify/client/model/Error.java
Normal file
140
client/src/main/java/com/github/gotify/client/model/Error.java
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Error contains error relevant information.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Error contains error relevant information.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Error {
|
||||||
|
@SerializedName("error")
|
||||||
|
private String error = null;
|
||||||
|
|
||||||
|
@SerializedName("errorCode")
|
||||||
|
private Long errorCode = null;
|
||||||
|
|
||||||
|
@SerializedName("errorDescription")
|
||||||
|
private String errorDescription = null;
|
||||||
|
|
||||||
|
public Error error(String error) {
|
||||||
|
this.error = error;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general error message
|
||||||
|
* @return error
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Unauthorized", required = true, value = "The general error message")
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error errorCode(Long errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The http error code.
|
||||||
|
* @return errorCode
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "401", required = true, value = "The http error code.")
|
||||||
|
public Long getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCode(Long errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error errorDescription(String errorDescription) {
|
||||||
|
this.errorDescription = errorDescription;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The http error code.
|
||||||
|
* @return errorDescription
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "you need to provide a valid access token or user credentials to access this api", required = true, value = "The http error code.")
|
||||||
|
public String getErrorDescription() {
|
||||||
|
return errorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorDescription(String errorDescription) {
|
||||||
|
this.errorDescription = errorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Error error = (Error) o;
|
||||||
|
return Objects.equals(this.error, error.error) &&
|
||||||
|
Objects.equals(this.errorCode, error.errorCode) &&
|
||||||
|
Objects.equals(this.errorDescription, error.errorDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(error, errorCode, errorDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Error {\n");
|
||||||
|
|
||||||
|
sb.append(" error: ").append(toIndentedString(error)).append("\n");
|
||||||
|
sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n");
|
||||||
|
sb.append(" errorDescription: ").append(toIndentedString(errorDescription)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
183
client/src/main/java/com/github/gotify/client/model/Message.java
Normal file
183
client/src/main/java/com/github/gotify/client/model/Message.java
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Message holds information about a message which was sent by an Application.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Message holds information about a message which was sent by an Application.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Message {
|
||||||
|
@SerializedName("appid")
|
||||||
|
private Integer appid = null;
|
||||||
|
|
||||||
|
@SerializedName("date")
|
||||||
|
private OffsetDateTime date = null;
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id = null;
|
||||||
|
|
||||||
|
@SerializedName("message")
|
||||||
|
private String message = null;
|
||||||
|
|
||||||
|
@SerializedName("priority")
|
||||||
|
private Long priority = null;
|
||||||
|
|
||||||
|
@SerializedName("title")
|
||||||
|
private String title = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application id that send this message.
|
||||||
|
* @return appid
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5", required = true, value = "The application id that send this message.")
|
||||||
|
public Integer getAppid() {
|
||||||
|
return appid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date the message was created.
|
||||||
|
* @return date
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "2018-02-27T19:36:10.5045044+01:00", required = true, value = "The date the message was created.")
|
||||||
|
public OffsetDateTime getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The message id.
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "25", required = true, value = "The message id.")
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message message(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual message.
|
||||||
|
* @return message
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Backup was successfully finished.", required = true, value = "The actual message.")
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message priority(Long priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The priority of the message.
|
||||||
|
* @return priority
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "2", value = "The priority of the message.")
|
||||||
|
public Long getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(Long priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message title(String title) {
|
||||||
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the message.
|
||||||
|
* @return title
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "Backup", required = true, value = "The title of the message.")
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Message message = (Message) o;
|
||||||
|
return Objects.equals(this.appid, message.appid) &&
|
||||||
|
Objects.equals(this.date, message.date) &&
|
||||||
|
Objects.equals(this.id, message.id) &&
|
||||||
|
Objects.equals(this.message, message.message) &&
|
||||||
|
Objects.equals(this.priority, message.priority) &&
|
||||||
|
Objects.equals(this.title, message.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(appid, date, id, message, priority, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Message {\n");
|
||||||
|
|
||||||
|
sb.append(" appid: ").append(toIndentedString(appid)).append("\n");
|
||||||
|
sb.append(" date: ").append(toIndentedString(date)).append("\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||||
|
sb.append(" priority: ").append(toIndentedString(priority)).append("\n");
|
||||||
|
sb.append(" title: ").append(toIndentedString(title)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.github.gotify.client.model.Message;
|
||||||
|
import com.github.gotify.client.model.Paging;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the paging and the messages
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "Wrapper for the paging and the messages")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class PagedMessages {
|
||||||
|
@SerializedName("messages")
|
||||||
|
private List<Message> messages = new ArrayList<Message>();
|
||||||
|
|
||||||
|
@SerializedName("paging")
|
||||||
|
private Paging paging = null;
|
||||||
|
|
||||||
|
public PagedMessages messages(List<Message> messages) {
|
||||||
|
this.messages = messages;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedMessages addMessagesItem(Message messagesItem) {
|
||||||
|
this.messages.add(messagesItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The messages.
|
||||||
|
* @return messages
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = true, value = "The messages.")
|
||||||
|
public List<Message> getMessages() {
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessages(List<Message> messages) {
|
||||||
|
this.messages = messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedMessages paging(Paging paging) {
|
||||||
|
this.paging = paging;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get paging
|
||||||
|
* @return paging
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = true, value = "")
|
||||||
|
public Paging getPaging() {
|
||||||
|
return paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaging(Paging paging) {
|
||||||
|
this.paging = paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PagedMessages pagedMessages = (PagedMessages) o;
|
||||||
|
return Objects.equals(this.messages, pagedMessages.messages) &&
|
||||||
|
Objects.equals(this.paging, pagedMessages.paging);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(messages, paging);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class PagedMessages {\n");
|
||||||
|
|
||||||
|
sb.append(" messages: ").append(toIndentedString(messages)).append("\n");
|
||||||
|
sb.append(" paging: ").append(toIndentedString(paging)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
130
client/src/main/java/com/github/gotify/client/model/Paging.java
Normal file
130
client/src/main/java/com/github/gotify/client/model/Paging.java
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Paging holds holds information about the limit and making requests to the next page.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Paging holds holds information about the limit and making requests to the next page.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class Paging {
|
||||||
|
@SerializedName("limit")
|
||||||
|
private Long limit = null;
|
||||||
|
|
||||||
|
@SerializedName("next")
|
||||||
|
private String next = null;
|
||||||
|
|
||||||
|
@SerializedName("since")
|
||||||
|
private Integer since = null;
|
||||||
|
|
||||||
|
@SerializedName("size")
|
||||||
|
private Long size = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The limit of the messages for the current request.
|
||||||
|
* minimum: 1
|
||||||
|
* maximum: 200
|
||||||
|
* @return limit
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "123", required = true, value = "The limit of the messages for the current request.")
|
||||||
|
public Long getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The request url for the next page. Empty/Null when no next page is available.
|
||||||
|
* @return next
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "http://example.com/message?limit=50&since=123456", value = "The request url for the next page. Empty/Null when no next page is available.")
|
||||||
|
public String getNext() {
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the last message returned in the current request. Use this as alternative to the next link.
|
||||||
|
* minimum: 0
|
||||||
|
* @return since
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5", required = true, value = "The ID of the last message returned in the current request. Use this as alternative to the next link.")
|
||||||
|
public Integer getSince() {
|
||||||
|
return since;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of messages that got returned in the current request.
|
||||||
|
* @return size
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5", required = true, value = "The amount of messages that got returned in the current request.")
|
||||||
|
public Long getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Paging paging = (Paging) o;
|
||||||
|
return Objects.equals(this.limit, paging.limit) &&
|
||||||
|
Objects.equals(this.next, paging.next) &&
|
||||||
|
Objects.equals(this.since, paging.since) &&
|
||||||
|
Objects.equals(this.size, paging.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(limit, next, since, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Paging {\n");
|
||||||
|
|
||||||
|
sb.append(" limit: ").append(toIndentedString(limit)).append("\n");
|
||||||
|
sb.append(" next: ").append(toIndentedString(next)).append("\n");
|
||||||
|
sb.append(" since: ").append(toIndentedString(since)).append("\n");
|
||||||
|
sb.append(" size: ").append(toIndentedString(size)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
131
client/src/main/java/com/github/gotify/client/model/User.java
Normal file
131
client/src/main/java/com/github/gotify/client/model/User.java
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The User holds information about permission and other stuff.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The User holds information about permission and other stuff.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class User {
|
||||||
|
@SerializedName("admin")
|
||||||
|
private Boolean admin = null;
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id = null;
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
public User admin(Boolean admin) {
|
||||||
|
this.admin = admin;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the user is an administrator.
|
||||||
|
* @return admin
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "true", value = "If the user is an administrator.")
|
||||||
|
public Boolean isAdmin() {
|
||||||
|
return admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdmin(Boolean admin) {
|
||||||
|
this.admin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user id.
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "25", required = true, value = "The user id.")
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user name. For login.
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "unicorn", required = true, value = "The user name. For login.")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
User user = (User) o;
|
||||||
|
return Objects.equals(this.admin, user.admin) &&
|
||||||
|
Objects.equals(this.id, user.id) &&
|
||||||
|
Objects.equals(this.name, user.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(admin, id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class User {\n");
|
||||||
|
|
||||||
|
sb.append(" admin: ").append(toIndentedString(admin)).append("\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Password for updating the user.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The Password for updating the user.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class UserPass {
|
||||||
|
@SerializedName("pass")
|
||||||
|
private String pass = null;
|
||||||
|
|
||||||
|
public UserPass pass(String pass) {
|
||||||
|
this.pass = pass;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user password. For login.
|
||||||
|
* @return pass
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "nrocinu", required = true, value = "The user password. For login.")
|
||||||
|
public String getPass() {
|
||||||
|
return pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPass(String pass) {
|
||||||
|
this.pass = pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UserPass userPass = (UserPass) o;
|
||||||
|
return Objects.equals(this.pass, userPass.pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class UserPass {\n");
|
||||||
|
|
||||||
|
sb.append(" pass: ").append(toIndentedString(pass)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UserWithPass holds information about the credentials and other stuff.
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "The UserWithPass holds information about the credentials and other stuff.")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class UserWithPass {
|
||||||
|
@SerializedName("admin")
|
||||||
|
private Boolean admin = null;
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id = null;
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
@SerializedName("pass")
|
||||||
|
private String pass = null;
|
||||||
|
|
||||||
|
public UserWithPass admin(Boolean admin) {
|
||||||
|
this.admin = admin;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the user is an administrator.
|
||||||
|
* @return admin
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "true", value = "If the user is an administrator.")
|
||||||
|
public Boolean isAdmin() {
|
||||||
|
return admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdmin(Boolean admin) {
|
||||||
|
this.admin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user id.
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "25", required = true, value = "The user id.")
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserWithPass name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user name. For login.
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "unicorn", required = true, value = "The user name. For login.")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserWithPass pass(String pass) {
|
||||||
|
this.pass = pass;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user password. For login.
|
||||||
|
* @return pass
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "nrocinu", required = true, value = "The user password. For login.")
|
||||||
|
public String getPass() {
|
||||||
|
return pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPass(String pass) {
|
||||||
|
this.pass = pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UserWithPass userWithPass = (UserWithPass) o;
|
||||||
|
return Objects.equals(this.admin, userWithPass.admin) &&
|
||||||
|
Objects.equals(this.id, userWithPass.id) &&
|
||||||
|
Objects.equals(this.name, userWithPass.name) &&
|
||||||
|
Objects.equals(this.pass, userWithPass.pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(admin, id, name, pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class UserWithPass {\n");
|
||||||
|
|
||||||
|
sb.append(" admin: ").append(toIndentedString(admin)).append("\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append(" pass: ").append(toIndentedString(pass)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VersionInfo Model
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "VersionInfo Model")
|
||||||
|
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-10-27T16:51:12.097+02:00")
|
||||||
|
public class VersionInfo {
|
||||||
|
@SerializedName("buildDate")
|
||||||
|
private String buildDate = null;
|
||||||
|
|
||||||
|
@SerializedName("commit")
|
||||||
|
private String commit = null;
|
||||||
|
|
||||||
|
@SerializedName("version")
|
||||||
|
private String version = null;
|
||||||
|
|
||||||
|
public VersionInfo buildDate(String buildDate) {
|
||||||
|
this.buildDate = buildDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date on which this binary was built.
|
||||||
|
* @return buildDate
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "2018-02-27T19:36:10.5045044+01:00", required = true, value = "The date on which this binary was built.")
|
||||||
|
public String getBuildDate() {
|
||||||
|
return buildDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildDate(String buildDate) {
|
||||||
|
this.buildDate = buildDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersionInfo commit(String commit) {
|
||||||
|
this.commit = commit;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The git commit hash on which this binary was built.
|
||||||
|
* @return commit
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "ae9512b6b6feea56a110d59a3353ea3b9c293864", required = true, value = "The git commit hash on which this binary was built.")
|
||||||
|
public String getCommit() {
|
||||||
|
return commit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommit(String commit) {
|
||||||
|
this.commit = commit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersionInfo version(String version) {
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current version.
|
||||||
|
* @return version
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(example = "5.2.6", required = true, value = "The current version.")
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
VersionInfo versionInfo = (VersionInfo) o;
|
||||||
|
return Objects.equals(this.buildDate, versionInfo.buildDate) &&
|
||||||
|
Objects.equals(this.commit, versionInfo.commit) &&
|
||||||
|
Objects.equals(this.version, versionInfo.version);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(buildDate, commit, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class VersionInfo {\n");
|
||||||
|
|
||||||
|
sb.append(" buildDate: ").append(toIndentedString(buildDate)).append("\n");
|
||||||
|
sb.append(" commit: ").append(toIndentedString(commit)).append("\n");
|
||||||
|
sb.append(" version: ").append(toIndentedString(version)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import com.github.gotify.client.model.Message;
|
||||||
|
import com.github.gotify.client.model.PagedMessages;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for MessageApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class MessageApiTest {
|
||||||
|
|
||||||
|
private final MessageApi api = new MessageApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a message.
|
||||||
|
*
|
||||||
|
* __NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createMessageTest() throws ApiException {
|
||||||
|
Message body = null;
|
||||||
|
Message response = api.createMessage(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages from a specific application.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteAppMessagesTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
api.deleteAppMessages(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a message with an id.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteMessageTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
api.deleteMessage(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all messages.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteMessagesTest() throws ApiException {
|
||||||
|
api.deleteMessages();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages from a specific application.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAppMessagesTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
Integer limit = null;
|
||||||
|
Integer since = null;
|
||||||
|
PagedMessages response = api.getAppMessages(id, limit, since);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all messages.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getMessagesTest() throws ApiException {
|
||||||
|
Integer limit = null;
|
||||||
|
Integer since = null;
|
||||||
|
PagedMessages response = api.getMessages(limit, since);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket, return newly created messages.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void streamMessagesTest() throws ApiException {
|
||||||
|
Message response = api.streamMessages();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.model.Application;
|
||||||
|
import com.github.gotify.client.model.Client;
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import java.io.File;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for TokenApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class TokenApiTest {
|
||||||
|
|
||||||
|
private final TokenApi api = new TokenApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an application.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createAppTest() throws ApiException {
|
||||||
|
Application body = null;
|
||||||
|
Application response = api.createApp(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a client.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createClientTest() throws ApiException {
|
||||||
|
Client body = null;
|
||||||
|
Client response = api.createClient(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an application.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteAppTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
api.deleteApp(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a client.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteClientTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
api.deleteClient(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all applications.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAppsTest() throws ApiException {
|
||||||
|
List<Application> response = api.getApps();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all clients.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getClientsTest() throws ApiException {
|
||||||
|
List<Client> response = api.getClients();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Upload an image for an application
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void uploadAppImageTest() throws ApiException {
|
||||||
|
File file = null;
|
||||||
|
Integer id = null;
|
||||||
|
Application response = api.uploadAppImage(file, id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.model.Error;
|
||||||
|
import com.github.gotify.client.model.User;
|
||||||
|
import com.github.gotify.client.model.UserPass;
|
||||||
|
import com.github.gotify.client.model.UserWithPass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for UserApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class UserApiTest {
|
||||||
|
|
||||||
|
private final UserApi api = new UserApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createUserTest() throws ApiException {
|
||||||
|
UserWithPass body = null;
|
||||||
|
User response = api.createUser(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void currentUserTest() throws ApiException {
|
||||||
|
User response = api.currentUser();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void deleteUserTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
api.deleteUser(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getUserTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
User response = api.getUser(id);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all users.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getUsersTest() throws ApiException {
|
||||||
|
List<User> response = api.getUsers();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the password of the current user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void updateCurrentUserTest() throws ApiException {
|
||||||
|
UserPass body = null;
|
||||||
|
api.updateCurrentUser(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a user.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void updateUserTest() throws ApiException {
|
||||||
|
Integer id = null;
|
||||||
|
UserWithPass body = null;
|
||||||
|
User response = api.updateUser(id, body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Gotify REST-API.
|
||||||
|
* This is the documentation of the Gotify REST-API. # Authentication In Gotify there are two token types: __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app) __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script) The token can be either transmitted through a header named `X-Gotify-Key` or a query parameter named `token`. There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken. \\--- Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.4
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.github.gotify.client.api;
|
||||||
|
|
||||||
|
import com.github.gotify.client.ApiException;
|
||||||
|
import com.github.gotify.client.model.VersionInfo;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for VersionApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class VersionApiTest {
|
||||||
|
|
||||||
|
private final VersionApi api = new VersionApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version information.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getVersionTest() throws ApiException {
|
||||||
|
VersionInfo response = api.getVersion();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
4
swagger.config.json
Normal file
4
swagger.config.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"apiPackage": "com.github.gotify.client.api",
|
||||||
|
"modelPackage": "com.github.gotify.client.model"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user