diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION index 6b4d157..ab6d278 100644 --- a/.swagger-codegen/VERSION +++ b/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3 \ No newline at end of file +2.4.4 \ No newline at end of file diff --git a/README.md b/README.md index 3272ac8..dcd41c2 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,36 @@ # swagger-java-client +fn +- API version: 2.0.0 + - Build date: 2019-03-27T15:47:31.669Z + +The open source serverless platform. + + +*Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen)* + + ## Requirements -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. +Building the API client library requires: +1. Java 1.7+ +2. Maven/Gradle ## Installation To install the API client library to your local Maven repository, simply execute: ```shell -mvn install +mvn clean install ``` To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: ```shell -mvn deploy +mvn clean deploy ``` -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. ### Maven users @@ -26,10 +38,10 @@ Add this dependency to your project's POM: ```xml - io.swagger - swagger-java-client - 1.0.0 - compile + io.swagger + swagger-java-client + 1.0.0 + compile ``` @@ -45,12 +57,14 @@ compile "io.swagger:swagger-java-client:1.0.0" At first generate the JAR by executing: - mvn package +```shell +mvn clean package +``` Then manually install the following JARs: -* target/swagger-java-client-1.0.0.jar -* target/lib/*.jar +* `target/swagger-java-client-1.0.0.jar` +* `target/lib/*.jar` ## Getting Started @@ -71,11 +85,12 @@ public class AppsApiExample { public static void main(String[] args) { AppsApi apiInstance = new AppsApi(); - String app = "app_example"; // String | Name of the app. + App body = new App(); // App | Application data to insert. try { - apiInstance.appsAppDelete(app); + App result = apiInstance.createApp(body); + System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsAppDelete"); + System.err.println("Exception when calling AppsApi#createApp"); e.printStackTrace(); } } @@ -85,45 +100,45 @@ public class AppsApiExample { ## Documentation for API Endpoints -All URIs are relative to *https://127.0.0.1:8080/v1* +All URIs are relative to *https://127.0.0.1:8080/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AppsApi* | [**appsAppDelete**](docs/AppsApi.md#appsAppDelete) | **DELETE** /apps/{app} | Delete an app. -*AppsApi* | [**appsAppGet**](docs/AppsApi.md#appsAppGet) | **GET** /apps/{app} | Get information for a app. -*AppsApi* | [**appsAppPatch**](docs/AppsApi.md#appsAppPatch) | **PATCH** /apps/{app} | Updates an app. -*AppsApi* | [**appsGet**](docs/AppsApi.md#appsGet) | **GET** /apps | Get all app names. -*AppsApi* | [**appsPost**](docs/AppsApi.md#appsPost) | **POST** /apps | Post new app -*CallApi* | [**appsAppCallsCallGet**](docs/CallApi.md#appsAppCallsCallGet) | **GET** /apps/{app}/calls/{call} | Get call information -*CallApi* | [**appsAppCallsCallLogGet**](docs/CallApi.md#appsAppCallsCallLogGet) | **GET** /apps/{app}/calls/{call}/log | Get call logs -*CallApi* | [**appsAppCallsGet**](docs/CallApi.md#appsAppCallsGet) | **GET** /apps/{app}/calls | Get app-bound calls. -*LogApi* | [**appsAppCallsCallLogGet**](docs/LogApi.md#appsAppCallsCallLogGet) | **GET** /apps/{app}/calls/{call}/log | Get call logs -*RoutesApi* | [**appsAppRoutesGet**](docs/RoutesApi.md#appsAppRoutesGet) | **GET** /apps/{app}/routes | Get route list by app name. -*RoutesApi* | [**appsAppRoutesPost**](docs/RoutesApi.md#appsAppRoutesPost) | **POST** /apps/{app}/routes | Create new Route -*RoutesApi* | [**appsAppRoutesRouteDelete**](docs/RoutesApi.md#appsAppRoutesRouteDelete) | **DELETE** /apps/{app}/routes/{route} | Deletes the route -*RoutesApi* | [**appsAppRoutesRouteGet**](docs/RoutesApi.md#appsAppRoutesRouteGet) | **GET** /apps/{app}/routes/{route} | Gets route by name -*RoutesApi* | [**appsAppRoutesRoutePatch**](docs/RoutesApi.md#appsAppRoutesRoutePatch) | **PATCH** /apps/{app}/routes/{route} | Update a Route, Fails if the route or app does not exist. Accepts partial updates / skips validation of zero values. -*RoutesApi* | [**appsAppRoutesRoutePut**](docs/RoutesApi.md#appsAppRoutesRoutePut) | **PUT** /apps/{app}/routes/{route} | Create a Route if it does not exist. Update if it does. Will also create app if it does not exist. Put does not skip validation of zero values +*AppsApi* | [**createApp**](docs/AppsApi.md#createApp) | **POST** /apps | Create A New Application +*AppsApi* | [**deleteApp**](docs/AppsApi.md#deleteApp) | **DELETE** /apps/{appID} | Delete An Application +*AppsApi* | [**getApp**](docs/AppsApi.md#getApp) | **GET** /apps/{appID} | Get Information For An Application +*AppsApi* | [**listApps**](docs/AppsApi.md#listApps) | **GET** /apps | Get A List Of Applications +*AppsApi* | [**updateApp**](docs/AppsApi.md#updateApp) | **PUT** /apps/{appID} | Update an Application +*CallApi* | [**fnsFnIDCallsCallIDGet**](docs/CallApi.md#fnsFnIDCallsCallIDGet) | **GET** /fns/{fnID}/calls/{callID} | Get call information +*CallApi* | [**fnsFnIDCallsGet**](docs/CallApi.md#fnsFnIDCallsGet) | **GET** /fns/{fnID}/calls | Get a fns calls. +*CallApi* | [**getCallLogs**](docs/CallApi.md#getCallLogs) | **GET** /fns/{fnID}/calls/{callID}/log | Get logs for a call. +*FnsApi* | [**createFn**](docs/FnsApi.md#createFn) | **POST** /fns | Create A New Function +*FnsApi* | [**deleteFn**](docs/FnsApi.md#deleteFn) | **DELETE** /fns/{fnID} | Delete A Function +*FnsApi* | [**getFn**](docs/FnsApi.md#getFn) | **GET** /fns/{fnID} | Get Definition Of A Function +*FnsApi* | [**listFns**](docs/FnsApi.md#listFns) | **GET** /fns | Get A list Of Functions Within An Application +*FnsApi* | [**updateFn**](docs/FnsApi.md#updateFn) | **PUT** /fns/{fnID} | Update A Function +*LogApi* | [**getCallLogs**](docs/LogApi.md#getCallLogs) | **GET** /fns/{fnID}/calls/{callID}/log | Get logs for a call. +*TriggersApi* | [**createTrigger**](docs/TriggersApi.md#createTrigger) | **POST** /triggers | Create A New Trigger. +*TriggersApi* | [**deleteTrigger**](docs/TriggersApi.md#deleteTrigger) | **DELETE** /triggers/{triggerID} | Delete A Trigger +*TriggersApi* | [**getTrigger**](docs/TriggersApi.md#getTrigger) | **GET** /triggers/{triggerID} | Get Definition Of A Trigger +*TriggersApi* | [**listTriggers**](docs/TriggersApi.md#listTriggers) | **GET** /triggers | Get A List Of Triggers Within An Application Or Function +*TriggersApi* | [**updateTrigger**](docs/TriggersApi.md#updateTrigger) | **PUT** /triggers/{triggerID} | Update A Trigger ## Documentation for Models - [App](docs/App.md) - - [AppWrapper](docs/AppWrapper.md) - - [AppsWrapper](docs/AppsWrapper.md) + - [AppList](docs/AppList.md) - [Call](docs/Call.md) - - [CallWrapper](docs/CallWrapper.md) - - [CallsWrapper](docs/CallsWrapper.md) + - [CallList](docs/CallList.md) - [Error](docs/Error.md) - - [ErrorBody](docs/ErrorBody.md) + - [Fn](docs/Fn.md) + - [FnList](docs/FnList.md) - [Log](docs/Log.md) - - [LogWrapper](docs/LogWrapper.md) - - [Route](docs/Route.md) - - [RouteWrapper](docs/RouteWrapper.md) - - [RoutesWrapper](docs/RoutesWrapper.md) - [Stat](docs/Stat.md) - [StatMetrics](docs/StatMetrics.md) - - [Version](docs/Version.md) + - [Trigger](docs/Trigger.md) + - [TriggerList](docs/TriggerList.md) ## Documentation for Authorization diff --git a/VERSION b/VERSION index f477849..359a5b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.2 \ No newline at end of file +2.0.0 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1ac0bc0..b864c08 100644 --- a/build.gradle +++ b/build.gradle @@ -94,10 +94,11 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.15' + compile 'io.swagger:swagger-annotations:1.5.17' 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 'joda-time:joda-time:2.9.9' + compile 'io.gsonfire:gson-fire:1.8.0' + compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/build.sbt b/build.sbt index 1f40fff..990e771 100644 --- a/build.sbt +++ b/build.sbt @@ -9,11 +9,12 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.15", + "io.swagger" % "swagger-annotations" % "1.5.17", "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", "com.google.code.gson" % "gson" % "2.8.1", - "joda-time" % "joda-time" % "2.9.9" % "compile", + "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" ) diff --git a/docs/App.md b/docs/App.md index 93fef73..d05b7b8 100644 --- a/docs/App.md +++ b/docs/App.md @@ -4,8 +4,13 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**id** | **String** | App ID | [optional] **name** | **String** | Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _. | [optional] -**config** | **Map<String, String>** | Application configuration, applied to all routes. | [optional] +**config** | **Map<String, String>** | Application function configuration, applied to all Functions. | [optional] +**annotations** | **Map<String, Object>** | Application annotations - this is a map of annotations attached to this app, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. | [optional] +**syslogUrl** | **String** | A comma separated list of syslog urls to send all function logs to. supports tls, udp or tcp. e.g. tls://logs.papertrailapp.com:1 | [optional] +**createdAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when app was created. Always in UTC. | [optional] +**updatedAt** | [**OffsetDateTime**](OffsetDateTime.md) | Most recent time that app was updated. Always in UTC. | [optional] diff --git a/docs/AppList.md b/docs/AppList.md new file mode 100644 index 0000000..50cc9bd --- /dev/null +++ b/docs/AppList.md @@ -0,0 +1,11 @@ + +# AppList + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nextCursor** | **String** | Cursor to send with subsequent request to receive the next page, if non-empty. | [optional] +**items** | [**List<App>**](App.md) | | + + + diff --git a/docs/AppsApi.md b/docs/AppsApi.md index c4911f9..1ad476f 100644 --- a/docs/AppsApi.md +++ b/docs/AppsApi.md @@ -1,23 +1,23 @@ # AppsApi -All URIs are relative to *https://127.0.0.1:8080/v1* +All URIs are relative to *https://127.0.0.1:8080/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**appsAppDelete**](AppsApi.md#appsAppDelete) | **DELETE** /apps/{app} | Delete an app. -[**appsAppGet**](AppsApi.md#appsAppGet) | **GET** /apps/{app} | Get information for a app. -[**appsAppPatch**](AppsApi.md#appsAppPatch) | **PATCH** /apps/{app} | Updates an app. -[**appsGet**](AppsApi.md#appsGet) | **GET** /apps | Get all app names. -[**appsPost**](AppsApi.md#appsPost) | **POST** /apps | Post new app +[**createApp**](AppsApi.md#createApp) | **POST** /apps | Create A New Application +[**deleteApp**](AppsApi.md#deleteApp) | **DELETE** /apps/{appID} | Delete An Application +[**getApp**](AppsApi.md#getApp) | **GET** /apps/{appID} | Get Information For An Application +[**listApps**](AppsApi.md#listApps) | **GET** /apps | Get A List Of Applications +[**updateApp**](AppsApi.md#updateApp) | **PUT** /apps/{appID} | Update an Application - -# **appsAppDelete** -> appsAppDelete(app) + +# **createApp** +> App createApp(body) -Delete an app. +Create A New Application -Delete an app. +Creates a new Application, returning the complete entity. ### Example ```java @@ -27,11 +27,12 @@ Delete an app. AppsApi apiInstance = new AppsApi(); -String app = "app_example"; // String | Name of the app. +App body = new App(); // App | Application data to insert. try { - apiInstance.appsAppDelete(app); + App result = apiInstance.createApp(body); + System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsAppDelete"); + System.err.println("Exception when calling AppsApi#createApp"); e.printStackTrace(); } ``` @@ -40,11 +41,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| Name of the app. | + **body** | [**App**](App.md)| Application data to insert. | ### Return type -null (empty response body) +[**App**](App.md) ### Authorization @@ -55,13 +56,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsAppGet** -> AppWrapper appsAppGet(app) + +# **deleteApp** +> deleteApp(appID) -Get information for a app. +Delete An Application -This gives more details about a app, such as statistics. +Delete the specified Application. ### Example ```java @@ -71,12 +72,11 @@ This gives more details about a app, such as statistics. AppsApi apiInstance = new AppsApi(); -String app = "app_example"; // String | name of the app. +String appID = "appID_example"; // String | Opaque, unique Application ID. try { - AppWrapper result = apiInstance.appsAppGet(app); - System.out.println(result); + apiInstance.deleteApp(appID); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsAppGet"); + System.err.println("Exception when calling AppsApi#deleteApp"); e.printStackTrace(); } ``` @@ -85,11 +85,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| name of the app. | + **appID** | **String**| Opaque, unique Application ID. | ### Return type -[**AppWrapper**](AppWrapper.md) +null (empty response body) ### Authorization @@ -100,13 +100,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsAppPatch** -> AppWrapper appsAppPatch(app, body) + +# **getApp** +> App getApp(appID) -Updates an app. +Get Information For An Application -You can set app level settings here. +Returns more details about an Application, such as statistics. ### Example ```java @@ -116,13 +116,12 @@ You can set app level settings here. AppsApi apiInstance = new AppsApi(); -String app = "app_example"; // String | name of the app. -AppWrapper body = new AppWrapper(); // AppWrapper | App to post. +String appID = "appID_example"; // String | Opaque, unique Application ID. try { - AppWrapper result = apiInstance.appsAppPatch(app, body); + App result = apiInstance.getApp(appID); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsAppPatch"); + System.err.println("Exception when calling AppsApi#getApp"); e.printStackTrace(); } ``` @@ -131,12 +130,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| name of the app. | - **body** | [**AppWrapper**](AppWrapper.md)| App to post. | + **appID** | **String**| Opaque, unique Application ID. | ### Return type -[**AppWrapper**](AppWrapper.md) +[**App**](App.md) ### Authorization @@ -147,13 +145,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsGet** -> AppsWrapper appsGet(cursor, perPage) + +# **listApps** +> AppList listApps(cursor, perPage, name) -Get all app names. +Get A List Of Applications -Get a list of all the apps in the system, returned in alphabetical order. +Get a filtered list of Applications in alphabetical order. ### Example ```java @@ -165,11 +163,12 @@ Get a list of all the apps in the system, returned in alphabetical order. AppsApi apiInstance = new AppsApi(); String cursor = "cursor_example"; // String | Cursor from previous response.next_cursor to begin results after, if any. Integer perPage = 56; // Integer | Number of results to return, defaults to 30. Max of 100. +String name = "name_example"; // String | The Application name to filter by. try { - AppsWrapper result = apiInstance.appsGet(cursor, perPage); + AppList result = apiInstance.listApps(cursor, perPage, name); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsGet"); + System.err.println("Exception when calling AppsApi#listApps"); e.printStackTrace(); } ``` @@ -180,10 +179,11 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **cursor** | **String**| Cursor from previous response.next_cursor to begin results after, if any. | [optional] **perPage** | **Integer**| Number of results to return, defaults to 30. Max of 100. | [optional] + **name** | **String**| The Application name to filter by. | [optional] ### Return type -[**AppsWrapper**](AppsWrapper.md) +[**AppList**](AppList.md) ### Authorization @@ -194,13 +194,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsPost** -> AppWrapper appsPost(body) + +# **updateApp** +> App updateApp(appID, body) -Post new app +Update an Application -Insert a new app +Updates an Application via merging the provided values. ### Example ```java @@ -210,12 +210,13 @@ Insert a new app AppsApi apiInstance = new AppsApi(); -AppWrapper body = new AppWrapper(); // AppWrapper | App to post. +String appID = "appID_example"; // String | Opaque, unique Application ID. +App body = new App(); // App | Application data to merge with current values. try { - AppWrapper result = apiInstance.appsPost(body); + App result = apiInstance.updateApp(appID, body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppsApi#appsPost"); + System.err.println("Exception when calling AppsApi#updateApp"); e.printStackTrace(); } ``` @@ -224,11 +225,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**AppWrapper**](AppWrapper.md)| App to post. | + **appID** | **String**| Opaque, unique Application ID. | + **body** | [**App**](App.md)| Application data to merge with current values. | ### Return type -[**AppWrapper**](AppWrapper.md) +[**App**](App.md) ### Authorization diff --git a/docs/Call.md b/docs/Call.md index c45abdd..606e395 100644 --- a/docs/Call.md +++ b/docs/Call.md @@ -4,14 +4,14 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | Call UUID ID. | [optional] +**id** | **String** | Call ID. | [optional] **status** | **String** | Call execution status. | [optional] **error** | **String** | Call execution error, if status is 'error'. | [optional] -**appName** | **String** | App name that is assigned to a route that is being executed. | [optional] -**path** | **String** | App route that is being executed. | [optional] -**createdAt** | [**DateTime**](DateTime.md) | Time when call was submitted. Always in UTC. | [optional] -**startedAt** | [**DateTime**](DateTime.md) | Time when call started execution. Always in UTC. | [optional] -**completedAt** | [**DateTime**](DateTime.md) | Time when call completed, whether it was successul or failed. Always in UTC. | [optional] +**appId** | **String** | App ID of fn that executed this call. | [optional] +**fnId** | **String** | Fn ID of fn that executed this call. | [optional] +**createdAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when call was submitted. Always in UTC. | [optional] +**startedAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when call started execution. Always in UTC. | [optional] +**completedAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when call completed, whether it was successul or failed. Always in UTC. | [optional] **stats** | [**List<Stat>**](Stat.md) | A histogram of stats for a call, each is a snapshot of a calls state at the timestamp. | [optional] diff --git a/docs/CallApi.md b/docs/CallApi.md index 008479d..4fcb74f 100644 --- a/docs/CallApi.md +++ b/docs/CallApi.md @@ -1,17 +1,17 @@ # CallApi -All URIs are relative to *https://127.0.0.1:8080/v1* +All URIs are relative to *https://127.0.0.1:8080/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**appsAppCallsCallGet**](CallApi.md#appsAppCallsCallGet) | **GET** /apps/{app}/calls/{call} | Get call information -[**appsAppCallsCallLogGet**](CallApi.md#appsAppCallsCallLogGet) | **GET** /apps/{app}/calls/{call}/log | Get call logs -[**appsAppCallsGet**](CallApi.md#appsAppCallsGet) | **GET** /apps/{app}/calls | Get app-bound calls. +[**fnsFnIDCallsCallIDGet**](CallApi.md#fnsFnIDCallsCallIDGet) | **GET** /fns/{fnID}/calls/{callID} | Get call information +[**fnsFnIDCallsGet**](CallApi.md#fnsFnIDCallsGet) | **GET** /fns/{fnID}/calls | Get a fns calls. +[**getCallLogs**](CallApi.md#getCallLogs) | **GET** /fns/{fnID}/calls/{callID}/log | Get logs for a call. - -# **appsAppCallsCallGet** -> CallWrapper appsAppCallsCallGet(app, call) + +# **fnsFnIDCallsCallIDGet** +> Call fnsFnIDCallsCallIDGet(fnID, callID) Get call information @@ -25,13 +25,13 @@ Get call information CallApi apiInstance = new CallApi(); -String app = "app_example"; // String | app name -String call = "call_example"; // String | Call ID. +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +String callID = "callID_example"; // String | Opaque, unique Call ID. try { - CallWrapper result = apiInstance.appsAppCallsCallGet(app, call); + Call result = apiInstance.fnsFnIDCallsCallIDGet(fnID, callID); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling CallApi#appsAppCallsCallGet"); + System.err.println("Exception when calling CallApi#fnsFnIDCallsCallIDGet"); e.printStackTrace(); } ``` @@ -40,12 +40,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| app name | - **call** | **String**| Call ID. | + **fnID** | **String**| Opaque, unique Function ID. | + **callID** | **String**| Opaque, unique Call ID. | ### Return type -[**CallWrapper**](CallWrapper.md) +[**Call**](Call.md) ### Authorization @@ -56,13 +56,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsAppCallsCallLogGet** -> LogWrapper appsAppCallsCallLogGet(app, call) + +# **fnsFnIDCallsGet** +> CallList fnsFnIDCallsGet(fnID, cursor, perPage, fromTime, toTime) -Get call logs +Get a fns calls. -Get call logs +Get a functions calls, results returned in created_at, descending order (newest first). ### Example ```java @@ -72,13 +72,16 @@ Get call logs CallApi apiInstance = new CallApi(); -String app = "app_example"; // String | App Name -String call = "call_example"; // String | Call ID. +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +String cursor = "cursor_example"; // String | Cursor from previous response.next_cursor to begin results after, if any. +Integer perPage = 56; // Integer | Number of results to return, defaults to 30. Max of 100. +Integer fromTime = 56; // Integer | Unix timestamp in seconds, of call.created_at to begin the results at, default 0. +Integer toTime = 56; // Integer | Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. try { - LogWrapper result = apiInstance.appsAppCallsCallLogGet(app, call); + CallList result = apiInstance.fnsFnIDCallsGet(fnID, cursor, perPage, fromTime, toTime); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling CallApi#appsAppCallsCallLogGet"); + System.err.println("Exception when calling CallApi#fnsFnIDCallsGet"); e.printStackTrace(); } ``` @@ -87,12 +90,15 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| App Name | - **call** | **String**| Call ID. | + **fnID** | **String**| Opaque, unique Function ID. | + **cursor** | **String**| Cursor from previous response.next_cursor to begin results after, if any. | [optional] + **perPage** | **Integer**| Number of results to return, defaults to 30. Max of 100. | [optional] + **fromTime** | **Integer**| Unix timestamp in seconds, of call.created_at to begin the results at, default 0. | [optional] + **toTime** | **Integer**| Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. | [optional] ### Return type -[**LogWrapper**](LogWrapper.md) +[**CallList**](CallList.md) ### Authorization @@ -103,13 +109,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - -# **appsAppCallsGet** -> CallsWrapper appsAppCallsGet(app, path, cursor, perPage, fromTime, toTime) + +# **getCallLogs** +> Log getCallLogs(fnID, callID) -Get app-bound calls. +Get logs for a call. -Get app-bound calls can filter to route-bound calls, results returned in created_at, descending order (newest first). +Get logs for a call. ### Example ```java @@ -119,17 +125,13 @@ Get app-bound calls can filter to route-bound calls, results returned in created CallApi apiInstance = new CallApi(); -String app = "app_example"; // String | App name. -String path = "path_example"; // String | Route path to match, exact. -String cursor = "cursor_example"; // String | Cursor from previous response.next_cursor to begin results after, if any. -Integer perPage = 56; // Integer | Number of results to return, defaults to 30. Max of 100. -Integer fromTime = 56; // Integer | Unix timestamp in seconds, of call.created_at to begin the results at, default 0. -Integer toTime = 56; // Integer | Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +String callID = "callID_example"; // String | Opaque, unique Call ID. try { - CallsWrapper result = apiInstance.appsAppCallsGet(app, path, cursor, perPage, fromTime, toTime); + Log result = apiInstance.getCallLogs(fnID, callID); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling CallApi#appsAppCallsGet"); + System.err.println("Exception when calling CallApi#getCallLogs"); e.printStackTrace(); } ``` @@ -138,16 +140,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| App name. | - **path** | **String**| Route path to match, exact. | [optional] - **cursor** | **String**| Cursor from previous response.next_cursor to begin results after, if any. | [optional] - **perPage** | **Integer**| Number of results to return, defaults to 30. Max of 100. | [optional] - **fromTime** | **Integer**| Unix timestamp in seconds, of call.created_at to begin the results at, default 0. | [optional] - **toTime** | **Integer**| Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. | [optional] + **fnID** | **String**| Opaque, unique Function ID. | + **callID** | **String**| Opaque, unique Call ID. | ### Return type -[**CallsWrapper**](CallsWrapper.md) +[**Log**](Log.md) ### Authorization diff --git a/docs/CallList.md b/docs/CallList.md new file mode 100644 index 0000000..8162b10 --- /dev/null +++ b/docs/CallList.md @@ -0,0 +1,11 @@ + +# CallList + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nextCursor** | **String** | Cursor to send with subsequent request to recieve next page, if non-empty. | [optional] +**items** | [**List<Call>**](Call.md) | | + + + diff --git a/docs/Error.md b/docs/Error.md index 3871bef..33af1a7 100644 --- a/docs/Error.md +++ b/docs/Error.md @@ -4,7 +4,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**error** | [**ErrorBody**](ErrorBody.md) | | [optional] +**message** | **String** | | [optional] +**fields** | **String** | | [optional] diff --git a/docs/Fn.md b/docs/Fn.md new file mode 100644 index 0000000..dfebf83 --- /dev/null +++ b/docs/Fn.md @@ -0,0 +1,20 @@ + +# Fn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | Unique identifier | [optional] +**name** | **String** | Unique name for this function. | [optional] +**appId** | **String** | App ID. | [optional] +**image** | **String** | Full container image name, e.g. hub.docker.com/fnproject/yo or fnproject/yo (default registry: hub.docker.com) | [optional] +**memory** | **Integer** | Maximum usable memory given to function (MiB). | [optional] +**timeout** | **Integer** | Timeout for executions of a function. Value in Seconds. | [optional] +**idleTimeout** | **Integer** | Hot functions idle timeout before container termination. Value in Seconds. | [optional] +**config** | **Map<String, String>** | Function configuration key values. | [optional] +**annotations** | **Map<String, Object>** | Func annotations - this is a map of annotations attached to this func, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. | [optional] +**createdAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when function was created. Always in UTC RFC3339. | [optional] +**updatedAt** | [**OffsetDateTime**](OffsetDateTime.md) | Most recent time that function was updated. Always in UTC RFC3339. | [optional] + + + diff --git a/docs/FnList.md b/docs/FnList.md new file mode 100644 index 0000000..12f36af --- /dev/null +++ b/docs/FnList.md @@ -0,0 +1,11 @@ + +# FnList + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nextCursor** | **String** | Cursor to send with subsequent request to receive the next page, if non-empty. | [optional] +**items** | [**List<Fn>**](Fn.md) | | + + + diff --git a/docs/FnsApi.md b/docs/FnsApi.md new file mode 100644 index 0000000..07a53f9 --- /dev/null +++ b/docs/FnsApi.md @@ -0,0 +1,245 @@ +# FnsApi + +All URIs are relative to *https://127.0.0.1:8080/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createFn**](FnsApi.md#createFn) | **POST** /fns | Create A New Function +[**deleteFn**](FnsApi.md#deleteFn) | **DELETE** /fns/{fnID} | Delete A Function +[**getFn**](FnsApi.md#getFn) | **GET** /fns/{fnID} | Get Definition Of A Function +[**listFns**](FnsApi.md#listFns) | **GET** /fns | Get A list Of Functions Within An Application +[**updateFn**](FnsApi.md#updateFn) | **PUT** /fns/{fnID} | Update A Function + + + +# **createFn** +> Fn createFn(body) + +Create A New Function + +Creates a new Function, returning the complete entity. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FnsApi; + + +FnsApi apiInstance = new FnsApi(); +Fn body = new Fn(); // Fn | Function data to insert. +try { + Fn result = apiInstance.createFn(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FnsApi#createFn"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Fn**](Fn.md)| Function data to insert. | + +### Return type + +[**Fn**](Fn.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **deleteFn** +> deleteFn(fnID) + +Delete A Function + +Delete the specified Function. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FnsApi; + + +FnsApi apiInstance = new FnsApi(); +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +try { + apiInstance.deleteFn(fnID); +} catch (ApiException e) { + System.err.println("Exception when calling FnsApi#deleteFn"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fnID** | **String**| Opaque, unique Function ID. | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **getFn** +> Fn getFn(fnID) + +Get Definition Of A Function + +Gets the definition for the Function with the specified ID. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FnsApi; + + +FnsApi apiInstance = new FnsApi(); +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +try { + Fn result = apiInstance.getFn(fnID); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FnsApi#getFn"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fnID** | **String**| Opaque, unique Function ID. | + +### Return type + +[**Fn**](Fn.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **listFns** +> FnList listFns(appId, cursor, perPage, name) + +Get A list Of Functions Within An Application + +Get a filtered list of Functions for an Application, in alphabetical order. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FnsApi; + + +FnsApi apiInstance = new FnsApi(); +String appId = "appId_example"; // String | Application ID. +String cursor = "cursor_example"; // String | Cursor from previous response.next_cursor to begin results after, if any. +Integer perPage = 56; // Integer | Number of results to return, defaults to 30. Max of 100. +String name = "name_example"; // String | Function name to filter by +try { + FnList result = apiInstance.listFns(appId, cursor, perPage, name); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FnsApi#listFns"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Application ID. | [optional] + **cursor** | **String**| Cursor from previous response.next_cursor to begin results after, if any. | [optional] + **perPage** | **Integer**| Number of results to return, defaults to 30. Max of 100. | [optional] + **name** | **String**| Function name to filter by | [optional] + +### Return type + +[**FnList**](FnList.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **updateFn** +> Fn updateFn(fnID, body) + +Update A Function + +Updates a Function via merging the provided values. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FnsApi; + + +FnsApi apiInstance = new FnsApi(); +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +Fn body = new Fn(); // Fn | Function data to merge with current values. +try { + Fn result = apiInstance.updateFn(fnID, body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FnsApi#updateFn"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fnID** | **String**| Opaque, unique Function ID. | + **body** | [**Fn**](Fn.md)| Function data to merge with current values. | + +### Return type + +[**Fn**](Fn.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/docs/LogApi.md b/docs/LogApi.md index d0aec3b..c03e568 100644 --- a/docs/LogApi.md +++ b/docs/LogApi.md @@ -1,19 +1,19 @@ # LogApi -All URIs are relative to *https://127.0.0.1:8080/v1* +All URIs are relative to *https://127.0.0.1:8080/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**appsAppCallsCallLogGet**](LogApi.md#appsAppCallsCallLogGet) | **GET** /apps/{app}/calls/{call}/log | Get call logs +[**getCallLogs**](LogApi.md#getCallLogs) | **GET** /fns/{fnID}/calls/{callID}/log | Get logs for a call. - -# **appsAppCallsCallLogGet** -> LogWrapper appsAppCallsCallLogGet(app, call) + +# **getCallLogs** +> Log getCallLogs(fnID, callID) -Get call logs +Get logs for a call. -Get call logs +Get logs for a call. ### Example ```java @@ -23,13 +23,13 @@ Get call logs LogApi apiInstance = new LogApi(); -String app = "app_example"; // String | App Name -String call = "call_example"; // String | Call ID. +String fnID = "fnID_example"; // String | Opaque, unique Function ID. +String callID = "callID_example"; // String | Opaque, unique Call ID. try { - LogWrapper result = apiInstance.appsAppCallsCallLogGet(app, call); + Log result = apiInstance.getCallLogs(fnID, callID); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling LogApi#appsAppCallsCallLogGet"); + System.err.println("Exception when calling LogApi#getCallLogs"); e.printStackTrace(); } ``` @@ -38,12 +38,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **String**| App Name | - **call** | **String**| Call ID. | + **fnID** | **String**| Opaque, unique Function ID. | + **callID** | **String**| Opaque, unique Call ID. | ### Return type -[**LogWrapper**](LogWrapper.md) +[**Log**](Log.md) ### Authorization diff --git a/docs/Stat.md b/docs/Stat.md index a101b8d..4c81da4 100644 --- a/docs/Stat.md +++ b/docs/Stat.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**timestamp** | [**DateTime**](DateTime.md) | | [optional] +**timestamp** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] **metrics** | [**StatMetrics**](StatMetrics.md) | | [optional] diff --git a/docs/Trigger.md b/docs/Trigger.md new file mode 100644 index 0000000..112d21c --- /dev/null +++ b/docs/Trigger.md @@ -0,0 +1,18 @@ + +# Trigger + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | Unique Trigger identifier. | [optional] +**name** | **String** | Unique name for this trigger, used to identify this trigger. | [optional] +**type** | **String** | Class of trigger, e.g. schedule, http, queue | [optional] +**source** | **String** | URI path for this trigger. e.g. `sayHello`, `say/hello` | [optional] +**fnId** | **String** | Opaque, unique Function identifier | [optional] +**appId** | **String** | Opaque, unique Application identifier | [optional] +**annotations** | **Map<String, Object>** | Trigger annotations - this is a map of annotations attached to this trigger, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. | [optional] +**createdAt** | [**OffsetDateTime**](OffsetDateTime.md) | Time when trigger was created. Always in UTC. | [optional] +**updatedAt** | [**OffsetDateTime**](OffsetDateTime.md) | Most recent time that trigger was updated. Always in UTC. | [optional] + + + diff --git a/docs/TriggerList.md b/docs/TriggerList.md new file mode 100644 index 0000000..ade993b --- /dev/null +++ b/docs/TriggerList.md @@ -0,0 +1,11 @@ + +# TriggerList + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nextCursor** | **String** | Cursor to send with subsequent request to receive the next page, if non-empty. | [optional] +**items** | [**List<Trigger>**](Trigger.md) | | + + + diff --git a/docs/TriggersApi.md b/docs/TriggersApi.md new file mode 100644 index 0000000..52d878a --- /dev/null +++ b/docs/TriggersApi.md @@ -0,0 +1,247 @@ +# TriggersApi + +All URIs are relative to *https://127.0.0.1:8080/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createTrigger**](TriggersApi.md#createTrigger) | **POST** /triggers | Create A New Trigger. +[**deleteTrigger**](TriggersApi.md#deleteTrigger) | **DELETE** /triggers/{triggerID} | Delete A Trigger +[**getTrigger**](TriggersApi.md#getTrigger) | **GET** /triggers/{triggerID} | Get Definition Of A Trigger +[**listTriggers**](TriggersApi.md#listTriggers) | **GET** /triggers | Get A List Of Triggers Within An Application Or Function +[**updateTrigger**](TriggersApi.md#updateTrigger) | **PUT** /triggers/{triggerID} | Update A Trigger + + + +# **createTrigger** +> Trigger createTrigger(body) + +Create A New Trigger. + +Creates a new Trigger, returning the complete entity. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.TriggersApi; + + +TriggersApi apiInstance = new TriggersApi(); +Trigger body = new Trigger(); // Trigger | Trigger data to insert. +try { + Trigger result = apiInstance.createTrigger(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling TriggersApi#createTrigger"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Trigger**](Trigger.md)| Trigger data to insert. | + +### Return type + +[**Trigger**](Trigger.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **deleteTrigger** +> deleteTrigger(triggerID) + +Delete A Trigger + +Delete the specified Trigger. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.TriggersApi; + + +TriggersApi apiInstance = new TriggersApi(); +String triggerID = "triggerID_example"; // String | Opaque, unique Trigger ID. +try { + apiInstance.deleteTrigger(triggerID); +} catch (ApiException e) { + System.err.println("Exception when calling TriggersApi#deleteTrigger"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **triggerID** | **String**| Opaque, unique Trigger ID. | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **getTrigger** +> Trigger getTrigger(triggerID) + +Get Definition Of A Trigger + +Gets the definition for the Trigger with the specified ID. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.TriggersApi; + + +TriggersApi apiInstance = new TriggersApi(); +String triggerID = "triggerID_example"; // String | Opaque, unique Trigger ID. +try { + Trigger result = apiInstance.getTrigger(triggerID); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling TriggersApi#getTrigger"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **triggerID** | **String**| Opaque, unique Trigger ID. | + +### Return type + +[**Trigger**](Trigger.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **listTriggers** +> TriggerList listTriggers(appId, fnId, cursor, perPage, name) + +Get A List Of Triggers Within An Application Or Function + +This will list all Triggers for a particular Application or Function, returned in name alphabetical order. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.TriggersApi; + + +TriggersApi apiInstance = new TriggersApi(); +String appId = "appId_example"; // String | Application ID. +String fnId = "fnId_example"; // String | Function ID. +String cursor = "cursor_example"; // String | Cursor from previous response.next_cursor to begin results after, if any. +Integer perPage = 56; // Integer | Number of results to return, defaults to 30. Max of 100. +String name = "name_example"; // String | A Trigger name to filter by. +try { + TriggerList result = apiInstance.listTriggers(appId, fnId, cursor, perPage, name); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling TriggersApi#listTriggers"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Application ID. | [optional] + **fnId** | **String**| Function ID. | [optional] + **cursor** | **String**| Cursor from previous response.next_cursor to begin results after, if any. | [optional] + **perPage** | **Integer**| Number of results to return, defaults to 30. Max of 100. | [optional] + **name** | **String**| A Trigger name to filter by. | [optional] + +### Return type + +[**TriggerList**](TriggerList.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **updateTrigger** +> Trigger updateTrigger(triggerID, body) + +Update A Trigger + +Updates a Trigger by merging the provided values. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.TriggersApi; + + +TriggersApi apiInstance = new TriggersApi(); +String triggerID = "triggerID_example"; // String | Opaque, unique Trigger ID. +Trigger body = new Trigger(); // Trigger | Trigger data to merge into current value. +try { + Trigger result = apiInstance.updateTrigger(triggerID, body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling TriggersApi#updateTrigger"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **triggerID** | **String**| Opaque, unique Trigger ID. | + **body** | [**Trigger**](Trigger.md)| Trigger data to merge into current value. | + +### Return type + +[**Trigger**](Trigger.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/git_push.sh b/git_push.sh index 6ca091b..da84dcd 100644 --- a/git_push.sh +++ b/git_push.sh @@ -36,7 +36,7 @@ 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 crediential in your environment." + 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 diff --git a/pom.xml b/pom.xml index 434f09d..db554bd 100644 --- a/pom.xml +++ b/pom.xml @@ -1,217 +1,242 @@ - 4.0.0 - io.swagger - swagger-java-client - jar - swagger-java-client - 1.0.0 - https://github.com/swagger-api/swagger-codegen - Swagger Java - - scm:git:git@github.com:swagger-api/swagger-codegen.git - scm:git:git@github.com:swagger-api/swagger-codegen.git + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + io.swagger + swagger-java-client + jar + swagger-java-client + 1.0.0 https://github.com/swagger-api/swagger-codegen - - - 2.2.0 - + Swagger Java + + scm:git:git@github.com:swagger-api/swagger-codegen.git + scm:git:git@github.com:swagger-api/swagger-codegen.git + https://github.com/swagger-api/swagger-codegen + - - - Unlicense - http://unlicense.org - repo - - + + + Unlicense + http://unlicense.org + repo + + - - - Swagger - apiteam@swagger.io - Swagger - http://swagger.io - - + + + Swagger + apiteam@swagger.io + Swagger + http://swagger.io + + - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - - - - jar - test-jar - - - - - - + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + - - org.codehaus.mojo - build-helper-maven-plugin - 1.10 - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + - - - sign-artifacts - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + - - - + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - com.squareup.okhttp - okhttp - ${okhttp-version} - - - com.squareup.okhttp - logging-interceptor - ${okhttp-version} - - - com.google.code.gson - gson - ${gson-version} - - - joda-time - joda-time - ${jodatime-version} - - - - junit - junit - ${junit-version} - test - - - - 1.7 - ${java.version} - ${java.version} - 1.5.15 - 2.7.5 - 2.8.1 - 2.9.9 - 1.0.0 - 4.12 - UTF-8 - + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + com.squareup.okhttp + okhttp + ${okhttp-version} + + + com.squareup.okhttp + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.threeten + threetenbp + ${threetenbp-version} + + + + junit + junit + ${junit-version} + test + + + + 1.7 + ${java.version} + ${java.version} + 1.8.0 + 1.5.18 + 2.7.5 + 2.8.1 + 1.3.5 + 1.0.0 + 4.12 + UTF-8 + diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 0000000..465dcb5 --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/io/swagger/client/ApiCallback.java b/src/main/java/io/swagger/client/ApiCallback.java new file mode 100644 index 0000000..17904be --- /dev/null +++ b/src/main/java/io/swagger/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + 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); +} diff --git a/src/main/java/io/swagger/client/ApiClient.java b/src/main/java/io/swagger/client/ApiClient.java new file mode 100644 index 0000000..c02cc85 --- /dev/null +++ b/src/main/java/io/swagger/client/ApiClient.java @@ -0,0 +1,1205 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +import com.squareup.okhttp.*; +import com.squareup.okhttp.internal.http.HttpMethod; +import com.squareup.okhttp.logging.HttpLoggingInterceptor; +import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import io.swagger.client.auth.Authentication; +import io.swagger.client.auth.HttpBasicAuth; +import io.swagger.client.auth.ApiKeyAuth; +import io.swagger.client.auth.OAuth; + +public class ApiClient { + + private String basePath = "https://127.0.0.1:8080/v2"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Constructor for ApiClient + */ + public ApiClient() { + httpClient = new OkHttpClient(); + + + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("Swagger-Codegen/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Get base path + * + * @return Baes path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://127.0.0.1:8080/v2 + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client + * + * @param httpClient An instance of OkHttpClient + * @return Api Client + */ + public ApiClient setHttpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient.interceptors().add(loggingInterceptor); + } else { + httpClient.interceptors().remove(loggingInterceptor); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.getConnectTimeout(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.getReadTimeout(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.getWriteTimeout(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection)param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create(MediaType.parse(contentType), (File) obj); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(MediaType.parse(contentType), content); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @throws IOException If fail to prepare file for download + * @return Prepared file for the download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @throws ApiException If fail to execute the call + * @return ApiResponse<T> + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @see #execute(Call, Type) + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Request request, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @throws ApiException If the response has a unsuccessful status code or + * fail to deserialize the response body + * @return Type + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create(MediaType.parse(contentType), ""); + } + } else { + reqBody = serialize(body, contentType); + } + + Request request = null; + + if(progressRequestListener != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the ofrm of Map + * @param reqBuilder Reqeust.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers = null; + HostnameVerifier hostnameVerifier = null; + if (!verifyingSsl) { + TrustManager trustAll = new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public X509Certificate[] getAcceptedIssuers() { return null; } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + trustManagers = new TrustManager[]{ trustAll }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { return true; } + }; + } else if (sslCaCert != null) { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(caKeyStore); + trustManagers = trustManagerFactory.getTrustManagers(); + } + + if (keyManagers != null || trustManagers != null) { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + } else { + httpClient.setSslSocketFactory(null); + } + httpClient.setHostnameVerifier(hostnameVerifier); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/src/main/java/io/swagger/client/ApiException.java b/src/main/java/io/swagger/client/ApiException.java new file mode 100644 index 0000000..acdee8e --- /dev/null +++ b/src/main/java/io/swagger/client/ApiException.java @@ -0,0 +1,91 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class ApiException extends Exception { + private int code = 0; + private Map> 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> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> 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> 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> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/io/swagger/client/ApiResponse.java b/src/main/java/io/swagger/client/ApiResponse.java new file mode 100644 index 0000000..124642b --- /dev/null +++ b/src/main/java/io/swagger/client/ApiResponse.java @@ -0,0 +1,59 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + final private int statusCode; + final private Map> 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> 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> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/src/main/java/io/swagger/client/Configuration.java b/src/main/java/io/swagger/client/Configuration.java new file mode 100644 index 0000000..f2b24de --- /dev/null +++ b/src/main/java/io/swagger/client/Configuration.java @@ -0,0 +1,39 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +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; + } +} diff --git a/src/main/java/io/swagger/client/GzipRequestInterceptor.java b/src/main/java/io/swagger/client/GzipRequestInterceptor.java new file mode 100644 index 0000000..821f890 --- /dev/null +++ b/src/main/java/io/swagger/client/GzipRequestInterceptor.java @@ -0,0 +1,81 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.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(); + } + }; + } +} \ No newline at end of file diff --git a/src/main/java/io/swagger/client/JSON.java b/src/main/java/io/swagger/client/JSON.java new file mode 100644 index 0000000..507ca7c --- /dev/null +++ b/src/main/java/io/swagger/client/JSON.java @@ -0,0 +1,394 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.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 io.swagger.client.model.*; +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.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(); + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if(null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + 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) + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .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 Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) + return (T) body; + else throw (e); + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public 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 { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() { + } + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() { + } + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/src/main/java/io/swagger/client/Pair.java b/src/main/java/io/swagger/client/Pair.java new file mode 100644 index 0000000..e13e31f --- /dev/null +++ b/src/main/java/io/swagger/client/Pair.java @@ -0,0 +1,52 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +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; + } +} diff --git a/src/main/java/io/swagger/client/ProgressRequestBody.java b/src/main/java/io/swagger/client/ProgressRequestBody.java new file mode 100644 index 0000000..d1c219c --- /dev/null +++ b/src/main/java/io/swagger/client/ProgressRequestBody.java @@ -0,0 +1,77 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.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); + } + }; + } +} diff --git a/src/main/java/io/swagger/client/ProgressResponseBody.java b/src/main/java/io/swagger/client/ProgressResponseBody.java new file mode 100644 index 0000000..fd3547e --- /dev/null +++ b/src/main/java/io/swagger/client/ProgressResponseBody.java @@ -0,0 +1,76 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.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; + } + }; + } +} + + diff --git a/src/main/java/io/swagger/client/StringUtil.java b/src/main/java/io/swagger/client/StringUtil.java new file mode 100644 index 0000000..6a49909 --- /dev/null +++ b/src/main/java/io/swagger/client/StringUtil.java @@ -0,0 +1,55 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

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

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/src/main/java/io/swagger/client/api/AppsApi.java b/src/main/java/io/swagger/client/api/AppsApi.java new file mode 100644 index 0000000..97fb969 --- /dev/null +++ b/src/main/java/io/swagger/client/api/AppsApi.java @@ -0,0 +1,686 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.App; +import io.swagger.client.model.AppList; +import io.swagger.client.model.Error; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AppsApi { + private ApiClient apiClient; + + public AppsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AppsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for createApp + * @param body Application data to insert. (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(App body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/apps"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call createAppValidateBeforeCall(App 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 A New Application + * Creates a new Application, returning the complete entity. + * @param body Application data to insert. (required) + * @return App + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public App createApp(App body) throws ApiException { + ApiResponse resp = createAppWithHttpInfo(body); + return resp.getData(); + } + + /** + * Create A New Application + * Creates a new Application, returning the complete entity. + * @param body Application data to insert. (required) + * @return ApiResponse<App> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createAppWithHttpInfo(App body) throws ApiException { + com.squareup.okhttp.Call call = createAppValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Create A New Application (asynchronously) + * Creates a new Application, returning the complete entity. + * @param body Application data to insert. (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(App body, final ApiCallback 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(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for deleteApp + * @param appID Opaque, unique 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(String appID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/apps/{appID}" + .replaceAll("\\{" + "appID" + "\\}", apiClient.escapeString(appID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteAppValidateBeforeCall(String appID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'appID' is set + if (appID == null) { + throw new ApiException("Missing the required parameter 'appID' when calling deleteApp(Async)"); + } + + + com.squareup.okhttp.Call call = deleteAppCall(appID, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete An Application + * Delete the specified Application. + * @param appID Opaque, unique Application ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteApp(String appID) throws ApiException { + deleteAppWithHttpInfo(appID); + } + + /** + * Delete An Application + * Delete the specified Application. + * @param appID Opaque, unique 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 deleteAppWithHttpInfo(String appID) throws ApiException { + com.squareup.okhttp.Call call = deleteAppValidateBeforeCall(appID, null, null); + return apiClient.execute(call); + } + + /** + * Delete An Application (asynchronously) + * Delete the specified Application. + * @param appID Opaque, unique 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(String appID, final ApiCallback 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(appID, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /** + * Build call for getApp + * @param appID Opaque, unique 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 getAppCall(String appID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/apps/{appID}" + .replaceAll("\\{" + "appID" + "\\}", apiClient.escapeString(appID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 getAppValidateBeforeCall(String appID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'appID' is set + if (appID == null) { + throw new ApiException("Missing the required parameter 'appID' when calling getApp(Async)"); + } + + + com.squareup.okhttp.Call call = getAppCall(appID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Information For An Application + * Returns more details about an Application, such as statistics. + * @param appID Opaque, unique Application ID. (required) + * @return App + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public App getApp(String appID) throws ApiException { + ApiResponse resp = getAppWithHttpInfo(appID); + return resp.getData(); + } + + /** + * Get Information For An Application + * Returns more details about an Application, such as statistics. + * @param appID Opaque, unique Application ID. (required) + * @return ApiResponse<App> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getAppWithHttpInfo(String appID) throws ApiException { + com.squareup.okhttp.Call call = getAppValidateBeforeCall(appID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Information For An Application (asynchronously) + * Returns more details about an Application, such as statistics. + * @param appID Opaque, unique 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 getAppAsync(String appID, final ApiCallback 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 = getAppValidateBeforeCall(appID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for listApps + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name The Application name to filter by. (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 listAppsCall(String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/apps"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (cursor != null) + localVarQueryParams.addAll(apiClient.parameterToPair("cursor", cursor)); + if (perPage != null) + localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage)); + if (name != null) + localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 listAppsValidateBeforeCall(String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = listAppsCall(cursor, perPage, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get A List Of Applications + * Get a filtered list of Applications in alphabetical order. + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name The Application name to filter by. (optional) + * @return AppList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public AppList listApps(String cursor, Integer perPage, String name) throws ApiException { + ApiResponse resp = listAppsWithHttpInfo(cursor, perPage, name); + return resp.getData(); + } + + /** + * Get A List Of Applications + * Get a filtered list of Applications in alphabetical order. + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name The Application name to filter by. (optional) + * @return ApiResponse<AppList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse listAppsWithHttpInfo(String cursor, Integer perPage, String name) throws ApiException { + com.squareup.okhttp.Call call = listAppsValidateBeforeCall(cursor, perPage, name, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get A List Of Applications (asynchronously) + * Get a filtered list of Applications in alphabetical order. + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name The Application name to filter by. (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 listAppsAsync(String cursor, Integer perPage, String name, final ApiCallback 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 = listAppsValidateBeforeCall(cursor, perPage, name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for updateApp + * @param appID Opaque, unique Application ID. (required) + * @param body Application data to merge with current values. (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 updateAppCall(String appID, App body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/apps/{appID}" + .replaceAll("\\{" + "appID" + "\\}", apiClient.escapeString(appID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call updateAppValidateBeforeCall(String appID, App body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'appID' is set + if (appID == null) { + throw new ApiException("Missing the required parameter 'appID' when calling updateApp(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateApp(Async)"); + } + + + com.squareup.okhttp.Call call = updateAppCall(appID, body, progressListener, progressRequestListener); + return call; + + } + + /** + * Update an Application + * Updates an Application via merging the provided values. + * @param appID Opaque, unique Application ID. (required) + * @param body Application data to merge with current values. (required) + * @return App + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public App updateApp(String appID, App body) throws ApiException { + ApiResponse resp = updateAppWithHttpInfo(appID, body); + return resp.getData(); + } + + /** + * Update an Application + * Updates an Application via merging the provided values. + * @param appID Opaque, unique Application ID. (required) + * @param body Application data to merge with current values. (required) + * @return ApiResponse<App> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updateAppWithHttpInfo(String appID, App body) throws ApiException { + com.squareup.okhttp.Call call = updateAppValidateBeforeCall(appID, body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Update an Application (asynchronously) + * Updates an Application via merging the provided values. + * @param appID Opaque, unique Application ID. (required) + * @param body Application data to merge with current values. (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 updateAppAsync(String appID, App body, final ApiCallback 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 = updateAppValidateBeforeCall(appID, body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/CallApi.java b/src/main/java/io/swagger/client/api/CallApi.java new file mode 100644 index 0000000..d2bf9c9 --- /dev/null +++ b/src/main/java/io/swagger/client/api/CallApi.java @@ -0,0 +1,473 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Call; +import io.swagger.client.model.CallList; +import io.swagger.client.model.Error; +import io.swagger.client.model.Log; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CallApi { + private ApiClient apiClient; + + public CallApi() { + this(Configuration.getDefaultApiClient()); + } + + public CallApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for fnsFnIDCallsCallIDGet + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 fnsFnIDCallsCallIDGetCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}/calls/{callID}" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())) + .replaceAll("\\{" + "callID" + "\\}", apiClient.escapeString(callID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 fnsFnIDCallsCallIDGetValidateBeforeCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling fnsFnIDCallsCallIDGet(Async)"); + } + + // verify the required parameter 'callID' is set + if (callID == null) { + throw new ApiException("Missing the required parameter 'callID' when calling fnsFnIDCallsCallIDGet(Async)"); + } + + + com.squareup.okhttp.Call call = fnsFnIDCallsCallIDGetCall(fnID, callID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get call information + * Get call information + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return Call + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Call fnsFnIDCallsCallIDGet(String fnID, String callID) throws ApiException { + ApiResponse resp = fnsFnIDCallsCallIDGetWithHttpInfo(fnID, callID); + return resp.getData(); + } + + /** + * Get call information + * Get call information + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return ApiResponse<Call> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fnsFnIDCallsCallIDGetWithHttpInfo(String fnID, String callID) throws ApiException { + com.squareup.okhttp.Call call = fnsFnIDCallsCallIDGetValidateBeforeCall(fnID, callID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get call information (asynchronously) + * Get call information + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 fnsFnIDCallsCallIDGetAsync(String fnID, String callID, final ApiCallback 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 = fnsFnIDCallsCallIDGetValidateBeforeCall(fnID, callID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fnsFnIDCallsGet + * @param fnID Opaque, unique Function ID. (required) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param fromTime Unix timestamp in seconds, of call.created_at to begin the results at, default 0. (optional) + * @param toTime Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. (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 fnsFnIDCallsGetCall(String fnID, String cursor, Integer perPage, Integer fromTime, Integer toTime, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}/calls" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (cursor != null) + localVarQueryParams.addAll(apiClient.parameterToPair("cursor", cursor)); + if (perPage != null) + localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage)); + if (fromTime != null) + localVarQueryParams.addAll(apiClient.parameterToPair("from_time", fromTime)); + if (toTime != null) + localVarQueryParams.addAll(apiClient.parameterToPair("to_time", toTime)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 fnsFnIDCallsGetValidateBeforeCall(String fnID, String cursor, Integer perPage, Integer fromTime, Integer toTime, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling fnsFnIDCallsGet(Async)"); + } + + + com.squareup.okhttp.Call call = fnsFnIDCallsGetCall(fnID, cursor, perPage, fromTime, toTime, progressListener, progressRequestListener); + return call; + + } + + /** + * Get a fns calls. + * Get a functions calls, results returned in created_at, descending order (newest first). + * @param fnID Opaque, unique Function ID. (required) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param fromTime Unix timestamp in seconds, of call.created_at to begin the results at, default 0. (optional) + * @param toTime Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. (optional) + * @return CallList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public CallList fnsFnIDCallsGet(String fnID, String cursor, Integer perPage, Integer fromTime, Integer toTime) throws ApiException { + ApiResponse resp = fnsFnIDCallsGetWithHttpInfo(fnID, cursor, perPage, fromTime, toTime); + return resp.getData(); + } + + /** + * Get a fns calls. + * Get a functions calls, results returned in created_at, descending order (newest first). + * @param fnID Opaque, unique Function ID. (required) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param fromTime Unix timestamp in seconds, of call.created_at to begin the results at, default 0. (optional) + * @param toTime Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. (optional) + * @return ApiResponse<CallList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fnsFnIDCallsGetWithHttpInfo(String fnID, String cursor, Integer perPage, Integer fromTime, Integer toTime) throws ApiException { + com.squareup.okhttp.Call call = fnsFnIDCallsGetValidateBeforeCall(fnID, cursor, perPage, fromTime, toTime, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get a fns calls. (asynchronously) + * Get a functions calls, results returned in created_at, descending order (newest first). + * @param fnID Opaque, unique Function ID. (required) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param fromTime Unix timestamp in seconds, of call.created_at to begin the results at, default 0. (optional) + * @param toTime Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest. (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 fnsFnIDCallsGetAsync(String fnID, String cursor, Integer perPage, Integer fromTime, Integer toTime, final ApiCallback 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 = fnsFnIDCallsGetValidateBeforeCall(fnID, cursor, perPage, fromTime, toTime, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for getCallLogs + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 getCallLogsCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}/calls/{callID}/log" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())) + .replaceAll("\\{" + "callID" + "\\}", apiClient.escapeString(callID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 getCallLogsValidateBeforeCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling getCallLogs(Async)"); + } + + // verify the required parameter 'callID' is set + if (callID == null) { + throw new ApiException("Missing the required parameter 'callID' when calling getCallLogs(Async)"); + } + + + com.squareup.okhttp.Call call = getCallLogsCall(fnID, callID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get logs for a call. + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return Log + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Log getCallLogs(String fnID, String callID) throws ApiException { + ApiResponse resp = getCallLogsWithHttpInfo(fnID, callID); + return resp.getData(); + } + + /** + * Get logs for a call. + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return ApiResponse<Log> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getCallLogsWithHttpInfo(String fnID, String callID) throws ApiException { + com.squareup.okhttp.Call call = getCallLogsValidateBeforeCall(fnID, callID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get logs for a call. (asynchronously) + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 getCallLogsAsync(String fnID, String callID, final ApiCallback 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 = getCallLogsValidateBeforeCall(fnID, callID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/FnsApi.java b/src/main/java/io/swagger/client/api/FnsApi.java new file mode 100644 index 0000000..2f36178 --- /dev/null +++ b/src/main/java/io/swagger/client/api/FnsApi.java @@ -0,0 +1,692 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Error; +import io.swagger.client.model.Fn; +import io.swagger.client.model.FnList; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FnsApi { + private ApiClient apiClient; + + public FnsApi() { + this(Configuration.getDefaultApiClient()); + } + + public FnsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for createFn + * @param body Function data to insert. (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 createFnCall(Fn body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call createFnValidateBeforeCall(Fn 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 createFn(Async)"); + } + + + com.squareup.okhttp.Call call = createFnCall(body, progressListener, progressRequestListener); + return call; + + } + + /** + * Create A New Function + * Creates a new Function, returning the complete entity. + * @param body Function data to insert. (required) + * @return Fn + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Fn createFn(Fn body) throws ApiException { + ApiResponse resp = createFnWithHttpInfo(body); + return resp.getData(); + } + + /** + * Create A New Function + * Creates a new Function, returning the complete entity. + * @param body Function data to insert. (required) + * @return ApiResponse<Fn> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createFnWithHttpInfo(Fn body) throws ApiException { + com.squareup.okhttp.Call call = createFnValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Create A New Function (asynchronously) + * Creates a new Function, returning the complete entity. + * @param body Function data to insert. (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 createFnAsync(Fn body, final ApiCallback 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 = createFnValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for deleteFn + * @param fnID Opaque, unique Function 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 deleteFnCall(String fnID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteFnValidateBeforeCall(String fnID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling deleteFn(Async)"); + } + + + com.squareup.okhttp.Call call = deleteFnCall(fnID, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete A Function + * Delete the specified Function. + * @param fnID Opaque, unique Function ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteFn(String fnID) throws ApiException { + deleteFnWithHttpInfo(fnID); + } + + /** + * Delete A Function + * Delete the specified Function. + * @param fnID Opaque, unique Function 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 deleteFnWithHttpInfo(String fnID) throws ApiException { + com.squareup.okhttp.Call call = deleteFnValidateBeforeCall(fnID, null, null); + return apiClient.execute(call); + } + + /** + * Delete A Function (asynchronously) + * Delete the specified Function. + * @param fnID Opaque, unique Function 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 deleteFnAsync(String fnID, final ApiCallback 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 = deleteFnValidateBeforeCall(fnID, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /** + * Build call for getFn + * @param fnID Opaque, unique Function 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 getFnCall(String fnID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 getFnValidateBeforeCall(String fnID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling getFn(Async)"); + } + + + com.squareup.okhttp.Call call = getFnCall(fnID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Definition Of A Function + * Gets the definition for the Function with the specified ID. + * @param fnID Opaque, unique Function ID. (required) + * @return Fn + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Fn getFn(String fnID) throws ApiException { + ApiResponse resp = getFnWithHttpInfo(fnID); + return resp.getData(); + } + + /** + * Get Definition Of A Function + * Gets the definition for the Function with the specified ID. + * @param fnID Opaque, unique Function ID. (required) + * @return ApiResponse<Fn> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getFnWithHttpInfo(String fnID) throws ApiException { + com.squareup.okhttp.Call call = getFnValidateBeforeCall(fnID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Definition Of A Function (asynchronously) + * Gets the definition for the Function with the specified ID. + * @param fnID Opaque, unique Function 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 getFnAsync(String fnID, final ApiCallback 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 = getFnValidateBeforeCall(fnID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for listFns + * @param appId Application ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name Function name to filter by (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 listFnsCall(String appId, String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (appId != null) + localVarQueryParams.addAll(apiClient.parameterToPair("app_id", appId)); + if (cursor != null) + localVarQueryParams.addAll(apiClient.parameterToPair("cursor", cursor)); + if (perPage != null) + localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage)); + if (name != null) + localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 listFnsValidateBeforeCall(String appId, String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = listFnsCall(appId, cursor, perPage, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get A list Of Functions Within An Application + * Get a filtered list of Functions for an Application, in alphabetical order. + * @param appId Application ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name Function name to filter by (optional) + * @return FnList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public FnList listFns(String appId, String cursor, Integer perPage, String name) throws ApiException { + ApiResponse resp = listFnsWithHttpInfo(appId, cursor, perPage, name); + return resp.getData(); + } + + /** + * Get A list Of Functions Within An Application + * Get a filtered list of Functions for an Application, in alphabetical order. + * @param appId Application ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name Function name to filter by (optional) + * @return ApiResponse<FnList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse listFnsWithHttpInfo(String appId, String cursor, Integer perPage, String name) throws ApiException { + com.squareup.okhttp.Call call = listFnsValidateBeforeCall(appId, cursor, perPage, name, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get A list Of Functions Within An Application (asynchronously) + * Get a filtered list of Functions for an Application, in alphabetical order. + * @param appId Application ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name Function name to filter by (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 listFnsAsync(String appId, String cursor, Integer perPage, String name, final ApiCallback 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 = listFnsValidateBeforeCall(appId, cursor, perPage, name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for updateFn + * @param fnID Opaque, unique Function ID. (required) + * @param body Function data to merge with current values. (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 updateFnCall(String fnID, Fn body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fns/{fnID}" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call updateFnValidateBeforeCall(String fnID, Fn body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling updateFn(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateFn(Async)"); + } + + + com.squareup.okhttp.Call call = updateFnCall(fnID, body, progressListener, progressRequestListener); + return call; + + } + + /** + * Update A Function + * Updates a Function via merging the provided values. + * @param fnID Opaque, unique Function ID. (required) + * @param body Function data to merge with current values. (required) + * @return Fn + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Fn updateFn(String fnID, Fn body) throws ApiException { + ApiResponse resp = updateFnWithHttpInfo(fnID, body); + return resp.getData(); + } + + /** + * Update A Function + * Updates a Function via merging the provided values. + * @param fnID Opaque, unique Function ID. (required) + * @param body Function data to merge with current values. (required) + * @return ApiResponse<Fn> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updateFnWithHttpInfo(String fnID, Fn body) throws ApiException { + com.squareup.okhttp.Call call = updateFnValidateBeforeCall(fnID, body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Update A Function (asynchronously) + * Updates a Function via merging the provided values. + * @param fnID Opaque, unique Function ID. (required) + * @param body Function data to merge with current values. (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 updateFnAsync(String fnID, Fn body, final ApiCallback 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 = updateFnValidateBeforeCall(fnID, body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/LogApi.java b/src/main/java/io/swagger/client/api/LogApi.java new file mode 100644 index 0000000..a684ded --- /dev/null +++ b/src/main/java/io/swagger/client/api/LogApi.java @@ -0,0 +1,191 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Error; +import io.swagger.client.model.Log; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class LogApi { + private ApiClient apiClient; + + public LogApi() { + this(Configuration.getDefaultApiClient()); + } + + public LogApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for getCallLogs + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 getCallLogsCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fns/{fnID}/calls/{callID}/log" + .replaceAll("\\{" + "fnID" + "\\}", apiClient.escapeString(fnID.toString())) + .replaceAll("\\{" + "callID" + "\\}", apiClient.escapeString(callID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 getCallLogsValidateBeforeCall(String fnID, String callID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'fnID' is set + if (fnID == null) { + throw new ApiException("Missing the required parameter 'fnID' when calling getCallLogs(Async)"); + } + + // verify the required parameter 'callID' is set + if (callID == null) { + throw new ApiException("Missing the required parameter 'callID' when calling getCallLogs(Async)"); + } + + + com.squareup.okhttp.Call call = getCallLogsCall(fnID, callID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get logs for a call. + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return Log + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Log getCallLogs(String fnID, String callID) throws ApiException { + ApiResponse resp = getCallLogsWithHttpInfo(fnID, callID); + return resp.getData(); + } + + /** + * Get logs for a call. + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call ID. (required) + * @return ApiResponse<Log> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getCallLogsWithHttpInfo(String fnID, String callID) throws ApiException { + com.squareup.okhttp.Call call = getCallLogsValidateBeforeCall(fnID, callID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get logs for a call. (asynchronously) + * Get logs for a call. + * @param fnID Opaque, unique Function ID. (required) + * @param callID Opaque, unique Call 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 getCallLogsAsync(String fnID, String callID, final ApiCallback 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 = getCallLogsValidateBeforeCall(fnID, callID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/TriggersApi.java b/src/main/java/io/swagger/client/api/TriggersApi.java new file mode 100644 index 0000000..1e257aa --- /dev/null +++ b/src/main/java/io/swagger/client/api/TriggersApi.java @@ -0,0 +1,698 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Error; +import io.swagger.client.model.Trigger; +import io.swagger.client.model.TriggerList; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TriggersApi { + private ApiClient apiClient; + + public TriggersApi() { + this(Configuration.getDefaultApiClient()); + } + + public TriggersApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for createTrigger + * @param body Trigger data to insert. (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 createTriggerCall(Trigger body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/triggers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call createTriggerValidateBeforeCall(Trigger 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 createTrigger(Async)"); + } + + + com.squareup.okhttp.Call call = createTriggerCall(body, progressListener, progressRequestListener); + return call; + + } + + /** + * Create A New Trigger. + * Creates a new Trigger, returning the complete entity. + * @param body Trigger data to insert. (required) + * @return Trigger + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Trigger createTrigger(Trigger body) throws ApiException { + ApiResponse resp = createTriggerWithHttpInfo(body); + return resp.getData(); + } + + /** + * Create A New Trigger. + * Creates a new Trigger, returning the complete entity. + * @param body Trigger data to insert. (required) + * @return ApiResponse<Trigger> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createTriggerWithHttpInfo(Trigger body) throws ApiException { + com.squareup.okhttp.Call call = createTriggerValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Create A New Trigger. (asynchronously) + * Creates a new Trigger, returning the complete entity. + * @param body Trigger data to insert. (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 createTriggerAsync(Trigger body, final ApiCallback 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 = createTriggerValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for deleteTrigger + * @param triggerID Opaque, unique Trigger 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 deleteTriggerCall(String triggerID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/triggers/{triggerID}" + .replaceAll("\\{" + "triggerID" + "\\}", apiClient.escapeString(triggerID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteTriggerValidateBeforeCall(String triggerID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'triggerID' is set + if (triggerID == null) { + throw new ApiException("Missing the required parameter 'triggerID' when calling deleteTrigger(Async)"); + } + + + com.squareup.okhttp.Call call = deleteTriggerCall(triggerID, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete A Trigger + * Delete the specified Trigger. + * @param triggerID Opaque, unique Trigger ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTrigger(String triggerID) throws ApiException { + deleteTriggerWithHttpInfo(triggerID); + } + + /** + * Delete A Trigger + * Delete the specified Trigger. + * @param triggerID Opaque, unique Trigger 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 deleteTriggerWithHttpInfo(String triggerID) throws ApiException { + com.squareup.okhttp.Call call = deleteTriggerValidateBeforeCall(triggerID, null, null); + return apiClient.execute(call); + } + + /** + * Delete A Trigger (asynchronously) + * Delete the specified Trigger. + * @param triggerID Opaque, unique Trigger 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 deleteTriggerAsync(String triggerID, final ApiCallback 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 = deleteTriggerValidateBeforeCall(triggerID, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /** + * Build call for getTrigger + * @param triggerID Opaque, unique Trigger 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 getTriggerCall(String triggerID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/triggers/{triggerID}" + .replaceAll("\\{" + "triggerID" + "\\}", apiClient.escapeString(triggerID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 getTriggerValidateBeforeCall(String triggerID, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'triggerID' is set + if (triggerID == null) { + throw new ApiException("Missing the required parameter 'triggerID' when calling getTrigger(Async)"); + } + + + com.squareup.okhttp.Call call = getTriggerCall(triggerID, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Definition Of A Trigger + * Gets the definition for the Trigger with the specified ID. + * @param triggerID Opaque, unique Trigger ID. (required) + * @return Trigger + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Trigger getTrigger(String triggerID) throws ApiException { + ApiResponse resp = getTriggerWithHttpInfo(triggerID); + return resp.getData(); + } + + /** + * Get Definition Of A Trigger + * Gets the definition for the Trigger with the specified ID. + * @param triggerID Opaque, unique Trigger ID. (required) + * @return ApiResponse<Trigger> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getTriggerWithHttpInfo(String triggerID) throws ApiException { + com.squareup.okhttp.Call call = getTriggerValidateBeforeCall(triggerID, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Definition Of A Trigger (asynchronously) + * Gets the definition for the Trigger with the specified ID. + * @param triggerID Opaque, unique Trigger 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 getTriggerAsync(String triggerID, final ApiCallback 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 = getTriggerValidateBeforeCall(triggerID, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for listTriggers + * @param appId Application ID. (optional) + * @param fnId Function ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name A Trigger name to filter by. (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 listTriggersCall(String appId, String fnId, String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/triggers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (appId != null) + localVarQueryParams.addAll(apiClient.parameterToPair("app_id", appId)); + if (fnId != null) + localVarQueryParams.addAll(apiClient.parameterToPair("fn_id", fnId)); + if (cursor != null) + localVarQueryParams.addAll(apiClient.parameterToPair("cursor", cursor)); + if (perPage != null) + localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage)); + if (name != null) + localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 listTriggersValidateBeforeCall(String appId, String fnId, String cursor, Integer perPage, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = listTriggersCall(appId, fnId, cursor, perPage, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get A List Of Triggers Within An Application Or Function + * This will list all Triggers for a particular Application or Function, returned in name alphabetical order. + * @param appId Application ID. (optional) + * @param fnId Function ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name A Trigger name to filter by. (optional) + * @return TriggerList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public TriggerList listTriggers(String appId, String fnId, String cursor, Integer perPage, String name) throws ApiException { + ApiResponse resp = listTriggersWithHttpInfo(appId, fnId, cursor, perPage, name); + return resp.getData(); + } + + /** + * Get A List Of Triggers Within An Application Or Function + * This will list all Triggers for a particular Application or Function, returned in name alphabetical order. + * @param appId Application ID. (optional) + * @param fnId Function ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name A Trigger name to filter by. (optional) + * @return ApiResponse<TriggerList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse listTriggersWithHttpInfo(String appId, String fnId, String cursor, Integer perPage, String name) throws ApiException { + com.squareup.okhttp.Call call = listTriggersValidateBeforeCall(appId, fnId, cursor, perPage, name, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get A List Of Triggers Within An Application Or Function (asynchronously) + * This will list all Triggers for a particular Application or Function, returned in name alphabetical order. + * @param appId Application ID. (optional) + * @param fnId Function ID. (optional) + * @param cursor Cursor from previous response.next_cursor to begin results after, if any. (optional) + * @param perPage Number of results to return, defaults to 30. Max of 100. (optional) + * @param name A Trigger name to filter by. (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 listTriggersAsync(String appId, String fnId, String cursor, Integer perPage, String name, final ApiCallback 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 = listTriggersValidateBeforeCall(appId, fnId, cursor, perPage, name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for updateTrigger + * @param triggerID Opaque, unique Trigger ID. (required) + * @param body Trigger data to merge into current value. (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 updateTriggerCall(String triggerID, Trigger body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/triggers/{triggerID}" + .replaceAll("\\{" + "triggerID" + "\\}", apiClient.escapeString(triggerID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call updateTriggerValidateBeforeCall(String triggerID, Trigger body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'triggerID' is set + if (triggerID == null) { + throw new ApiException("Missing the required parameter 'triggerID' when calling updateTrigger(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateTrigger(Async)"); + } + + + com.squareup.okhttp.Call call = updateTriggerCall(triggerID, body, progressListener, progressRequestListener); + return call; + + } + + /** + * Update A Trigger + * Updates a Trigger by merging the provided values. + * @param triggerID Opaque, unique Trigger ID. (required) + * @param body Trigger data to merge into current value. (required) + * @return Trigger + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Trigger updateTrigger(String triggerID, Trigger body) throws ApiException { + ApiResponse resp = updateTriggerWithHttpInfo(triggerID, body); + return resp.getData(); + } + + /** + * Update A Trigger + * Updates a Trigger by merging the provided values. + * @param triggerID Opaque, unique Trigger ID. (required) + * @param body Trigger data to merge into current value. (required) + * @return ApiResponse<Trigger> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updateTriggerWithHttpInfo(String triggerID, Trigger body) throws ApiException { + com.squareup.okhttp.Call call = updateTriggerValidateBeforeCall(triggerID, body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Update A Trigger (asynchronously) + * Updates a Trigger by merging the provided values. + * @param triggerID Opaque, unique Trigger ID. (required) + * @param body Trigger data to merge into current value. (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 updateTriggerAsync(String triggerID, Trigger body, final ApiCallback 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 = updateTriggerValidateBeforeCall(triggerID, body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/src/main/java/io/swagger/client/auth/ApiKeyAuth.java new file mode 100644 index 0000000..ad0aab5 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -0,0 +1,75 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.auth; + +import io.swagger.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +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 queryParams, Map 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); + } + } +} diff --git a/src/main/java/io/swagger/client/auth/Authentication.java b/src/main/java/io/swagger/client/auth/Authentication.java new file mode 100644 index 0000000..a5b88d0 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/Authentication.java @@ -0,0 +1,29 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.auth; + +import io.swagger.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 queryParams, Map headerParams); +} diff --git a/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/src/main/java/io/swagger/client/auth/HttpBasicAuth.java new file mode 100644 index 0000000..d78ea92 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.auth; + +import io.swagger.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 queryParams, Map headerParams) { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/io/swagger/client/auth/OAuth.java b/src/main/java/io/swagger/client/auth/OAuth.java new file mode 100644 index 0000000..579c8c1 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/OAuth.java @@ -0,0 +1,39 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.auth; + +import io.swagger.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +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 queryParams, Map headerParams) { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/src/main/java/io/swagger/client/auth/OAuthFlow.java b/src/main/java/io/swagger/client/auth/OAuthFlow.java new file mode 100644 index 0000000..4db5286 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/src/main/java/io/swagger/client/model/App.java b/src/main/java/io/swagger/client/model/App.java new file mode 100644 index 0000000..93e982d --- /dev/null +++ b/src/main/java/io/swagger/client/model/App.java @@ -0,0 +1,216 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.threeten.bp.OffsetDateTime; + +/** + * App + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class App { + @SerializedName("id") + private String id = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("config") + private Map config = null; + + @SerializedName("annotations") + private Map annotations = null; + + @SerializedName("syslog_url") + private String syslogUrl = null; + + @SerializedName("created_at") + private OffsetDateTime createdAt = null; + + @SerializedName("updated_at") + private OffsetDateTime updatedAt = null; + + /** + * App ID + * @return id + **/ + @ApiModelProperty(value = "App ID") + public String getId() { + return id; + } + + /** + * Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _. + * @return name + **/ + @ApiModelProperty(value = "Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _.") + public String getName() { + return name; + } + + public App config(Map config) { + this.config = config; + return this; + } + + public App putConfigItem(String key, String configItem) { + if (this.config == null) { + this.config = new HashMap(); + } + this.config.put(key, configItem); + return this; + } + + /** + * Application function configuration, applied to all Functions. + * @return config + **/ + @ApiModelProperty(value = "Application function configuration, applied to all Functions.") + public Map getConfig() { + return config; + } + + public void setConfig(Map config) { + this.config = config; + } + + public App annotations(Map annotations) { + this.annotations = annotations; + return this; + } + + public App putAnnotationsItem(String key, Object annotationsItem) { + if (this.annotations == null) { + this.annotations = new HashMap(); + } + this.annotations.put(key, annotationsItem); + return this; + } + + /** + * Application annotations - this is a map of annotations attached to this app, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. + * @return annotations + **/ + @ApiModelProperty(value = "Application annotations - this is a map of annotations attached to this app, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes.") + public Map getAnnotations() { + return annotations; + } + + public void setAnnotations(Map annotations) { + this.annotations = annotations; + } + + public App syslogUrl(String syslogUrl) { + this.syslogUrl = syslogUrl; + return this; + } + + /** + * A comma separated list of syslog urls to send all function logs to. supports tls, udp or tcp. e.g. tls://logs.papertrailapp.com:1 + * @return syslogUrl + **/ + @ApiModelProperty(value = "A comma separated list of syslog urls to send all function logs to. supports tls, udp or tcp. e.g. tls://logs.papertrailapp.com:1") + public String getSyslogUrl() { + return syslogUrl; + } + + public void setSyslogUrl(String syslogUrl) { + this.syslogUrl = syslogUrl; + } + + /** + * Time when app was created. Always in UTC. + * @return createdAt + **/ + @ApiModelProperty(value = "Time when app was created. Always in UTC.") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Most recent time that app was updated. Always in UTC. + * @return updatedAt + **/ + @ApiModelProperty(value = "Most recent time that app was updated. Always in UTC.") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + App app = (App) o; + return Objects.equals(this.id, app.id) && + Objects.equals(this.name, app.name) && + Objects.equals(this.config, app.config) && + Objects.equals(this.annotations, app.annotations) && + Objects.equals(this.syslogUrl, app.syslogUrl) && + Objects.equals(this.createdAt, app.createdAt) && + Objects.equals(this.updatedAt, app.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, config, annotations, syslogUrl, createdAt, updatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class App {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" syslogUrl: ").append(toIndentedString(syslogUrl)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/AppList.java b/src/main/java/io/swagger/client/model/AppList.java new file mode 100644 index 0000000..160f6c3 --- /dev/null +++ b/src/main/java/io/swagger/client/model/AppList.java @@ -0,0 +1,116 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.App; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * AppList + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class AppList { + @SerializedName("next_cursor") + private String nextCursor = null; + + @SerializedName("items") + private List items = new ArrayList(); + + /** + * Cursor to send with subsequent request to receive the next page, if non-empty. + * @return nextCursor + **/ + @ApiModelProperty(value = "Cursor to send with subsequent request to receive the next page, if non-empty.") + public String getNextCursor() { + return nextCursor; + } + + public AppList items(List items) { + this.items = items; + return this; + } + + public AppList addItemsItem(App itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(required = true, value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppList appList = (AppList) o; + return Objects.equals(this.nextCursor, appList.nextCursor) && + Objects.equals(this.items, appList.items); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppList {\n"); + + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Call.java b/src/main/java/io/swagger/client/model/Call.java new file mode 100644 index 0000000..855c141 --- /dev/null +++ b/src/main/java/io/swagger/client/model/Call.java @@ -0,0 +1,201 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Stat; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.OffsetDateTime; + +/** + * Call + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Call { + @SerializedName("id") + private String id = null; + + @SerializedName("status") + private String status = null; + + @SerializedName("error") + private String error = null; + + @SerializedName("app_id") + private String appId = null; + + @SerializedName("fn_id") + private String fnId = null; + + @SerializedName("created_at") + private OffsetDateTime createdAt = null; + + @SerializedName("started_at") + private OffsetDateTime startedAt = null; + + @SerializedName("completed_at") + private OffsetDateTime completedAt = null; + + @SerializedName("stats") + private List stats = null; + + /** + * Call ID. + * @return id + **/ + @ApiModelProperty(value = "Call ID.") + public String getId() { + return id; + } + + /** + * Call execution status. + * @return status + **/ + @ApiModelProperty(value = "Call execution status.") + public String getStatus() { + return status; + } + + /** + * Call execution error, if status is 'error'. + * @return error + **/ + @ApiModelProperty(value = "Call execution error, if status is 'error'.") + public String getError() { + return error; + } + + /** + * App ID of fn that executed this call. + * @return appId + **/ + @ApiModelProperty(value = "App ID of fn that executed this call.") + public String getAppId() { + return appId; + } + + /** + * Fn ID of fn that executed this call. + * @return fnId + **/ + @ApiModelProperty(value = "Fn ID of fn that executed this call.") + public String getFnId() { + return fnId; + } + + /** + * Time when call was submitted. Always in UTC. + * @return createdAt + **/ + @ApiModelProperty(value = "Time when call was submitted. Always in UTC.") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Time when call started execution. Always in UTC. + * @return startedAt + **/ + @ApiModelProperty(value = "Time when call started execution. Always in UTC.") + public OffsetDateTime getStartedAt() { + return startedAt; + } + + /** + * Time when call completed, whether it was successul or failed. Always in UTC. + * @return completedAt + **/ + @ApiModelProperty(value = "Time when call completed, whether it was successul or failed. Always in UTC.") + public OffsetDateTime getCompletedAt() { + return completedAt; + } + + /** + * A histogram of stats for a call, each is a snapshot of a calls state at the timestamp. + * @return stats + **/ + @ApiModelProperty(value = "A histogram of stats for a call, each is a snapshot of a calls state at the timestamp.") + public List getStats() { + return stats; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Call call = (Call) o; + return Objects.equals(this.id, call.id) && + Objects.equals(this.status, call.status) && + Objects.equals(this.error, call.error) && + Objects.equals(this.appId, call.appId) && + Objects.equals(this.fnId, call.fnId) && + Objects.equals(this.createdAt, call.createdAt) && + Objects.equals(this.startedAt, call.startedAt) && + Objects.equals(this.completedAt, call.completedAt) && + Objects.equals(this.stats, call.stats); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, error, appId, fnId, createdAt, startedAt, completedAt, stats); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Call {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" fnId: ").append(toIndentedString(fnId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append(" completedAt: ").append(toIndentedString(completedAt)).append("\n"); + sb.append(" stats: ").append(toIndentedString(stats)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/CallList.java b/src/main/java/io/swagger/client/model/CallList.java new file mode 100644 index 0000000..bd5fc86 --- /dev/null +++ b/src/main/java/io/swagger/client/model/CallList.java @@ -0,0 +1,116 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Call; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * CallList + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class CallList { + @SerializedName("next_cursor") + private String nextCursor = null; + + @SerializedName("items") + private List items = new ArrayList(); + + /** + * Cursor to send with subsequent request to recieve next page, if non-empty. + * @return nextCursor + **/ + @ApiModelProperty(value = "Cursor to send with subsequent request to recieve next page, if non-empty.") + public String getNextCursor() { + return nextCursor; + } + + public CallList items(List items) { + this.items = items; + return this; + } + + public CallList addItemsItem(Call itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(required = true, value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CallList callList = (CallList) o; + return Objects.equals(this.nextCursor, callList.nextCursor) && + Objects.equals(this.items, callList.items); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallList {\n"); + + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Error.java b/src/main/java/io/swagger/client/model/Error.java new file mode 100644 index 0000000..db8c08e --- /dev/null +++ b/src/main/java/io/swagger/client/model/Error.java @@ -0,0 +1,99 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * Error + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Error { + @SerializedName("message") + private String message = null; + + @SerializedName("fields") + private String fields = null; + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + /** + * Get fields + * @return fields + **/ + @ApiModelProperty(value = "") + public String getFields() { + return fields; + } + + + @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.message, error.message) && + Objects.equals(this.fields, error.fields); + } + + @Override + public int hashCode() { + return Objects.hash(message, fields); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Fn.java b/src/main/java/io/swagger/client/model/Fn.java new file mode 100644 index 0000000..3e75555 --- /dev/null +++ b/src/main/java/io/swagger/client/model/Fn.java @@ -0,0 +1,317 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.threeten.bp.OffsetDateTime; + +/** + * Fn + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Fn { + @SerializedName("id") + private String id = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("app_id") + private String appId = null; + + @SerializedName("image") + private String image = null; + + @SerializedName("memory") + private Integer memory = null; + + @SerializedName("timeout") + private Integer timeout = 30; + + @SerializedName("idle_timeout") + private Integer idleTimeout = 30; + + @SerializedName("config") + private Map config = null; + + @SerializedName("annotations") + private Map annotations = null; + + @SerializedName("created_at") + private OffsetDateTime createdAt = null; + + @SerializedName("updated_at") + private OffsetDateTime updatedAt = null; + + /** + * Unique identifier + * @return id + **/ + @ApiModelProperty(value = "Unique identifier") + public String getId() { + return id; + } + + public Fn name(String name) { + this.name = name; + return this; + } + + /** + * Unique name for this function. + * @return name + **/ + @ApiModelProperty(value = "Unique name for this function.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Fn appId(String appId) { + this.appId = appId; + return this; + } + + /** + * App ID. + * @return appId + **/ + @ApiModelProperty(value = "App ID.") + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public Fn image(String image) { + this.image = image; + return this; + } + + /** + * Full container image name, e.g. hub.docker.com/fnproject/yo or fnproject/yo (default registry: hub.docker.com) + * @return image + **/ + @ApiModelProperty(value = "Full container image name, e.g. hub.docker.com/fnproject/yo or fnproject/yo (default registry: hub.docker.com)") + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public Fn memory(Integer memory) { + this.memory = memory; + return this; + } + + /** + * Maximum usable memory given to function (MiB). + * @return memory + **/ + @ApiModelProperty(value = "Maximum usable memory given to function (MiB).") + public Integer getMemory() { + return memory; + } + + public void setMemory(Integer memory) { + this.memory = memory; + } + + public Fn timeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Timeout for executions of a function. Value in Seconds. + * @return timeout + **/ + @ApiModelProperty(value = "Timeout for executions of a function. Value in Seconds.") + public Integer getTimeout() { + return timeout; + } + + public void setTimeout(Integer timeout) { + this.timeout = timeout; + } + + public Fn idleTimeout(Integer idleTimeout) { + this.idleTimeout = idleTimeout; + return this; + } + + /** + * Hot functions idle timeout before container termination. Value in Seconds. + * @return idleTimeout + **/ + @ApiModelProperty(value = "Hot functions idle timeout before container termination. Value in Seconds.") + public Integer getIdleTimeout() { + return idleTimeout; + } + + public void setIdleTimeout(Integer idleTimeout) { + this.idleTimeout = idleTimeout; + } + + public Fn config(Map config) { + this.config = config; + return this; + } + + public Fn putConfigItem(String key, String configItem) { + if (this.config == null) { + this.config = new HashMap(); + } + this.config.put(key, configItem); + return this; + } + + /** + * Function configuration key values. + * @return config + **/ + @ApiModelProperty(value = "Function configuration key values.") + public Map getConfig() { + return config; + } + + public void setConfig(Map config) { + this.config = config; + } + + public Fn annotations(Map annotations) { + this.annotations = annotations; + return this; + } + + public Fn putAnnotationsItem(String key, Object annotationsItem) { + if (this.annotations == null) { + this.annotations = new HashMap(); + } + this.annotations.put(key, annotationsItem); + return this; + } + + /** + * Func annotations - this is a map of annotations attached to this func, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. + * @return annotations + **/ + @ApiModelProperty(value = "Func annotations - this is a map of annotations attached to this func, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes.") + public Map getAnnotations() { + return annotations; + } + + public void setAnnotations(Map annotations) { + this.annotations = annotations; + } + + /** + * Time when function was created. Always in UTC RFC3339. + * @return createdAt + **/ + @ApiModelProperty(value = "Time when function was created. Always in UTC RFC3339.") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Most recent time that function was updated. Always in UTC RFC3339. + * @return updatedAt + **/ + @ApiModelProperty(value = "Most recent time that function was updated. Always in UTC RFC3339.") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Fn fn = (Fn) o; + return Objects.equals(this.id, fn.id) && + Objects.equals(this.name, fn.name) && + Objects.equals(this.appId, fn.appId) && + Objects.equals(this.image, fn.image) && + Objects.equals(this.memory, fn.memory) && + Objects.equals(this.timeout, fn.timeout) && + Objects.equals(this.idleTimeout, fn.idleTimeout) && + Objects.equals(this.config, fn.config) && + Objects.equals(this.annotations, fn.annotations) && + Objects.equals(this.createdAt, fn.createdAt) && + Objects.equals(this.updatedAt, fn.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, appId, image, memory, timeout, idleTimeout, config, annotations, createdAt, updatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Fn {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" image: ").append(toIndentedString(image)).append("\n"); + sb.append(" memory: ").append(toIndentedString(memory)).append("\n"); + sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); + sb.append(" idleTimeout: ").append(toIndentedString(idleTimeout)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/FnList.java b/src/main/java/io/swagger/client/model/FnList.java new file mode 100644 index 0000000..5873284 --- /dev/null +++ b/src/main/java/io/swagger/client/model/FnList.java @@ -0,0 +1,116 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Fn; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * FnList + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class FnList { + @SerializedName("next_cursor") + private String nextCursor = null; + + @SerializedName("items") + private List items = new ArrayList(); + + /** + * Cursor to send with subsequent request to receive the next page, if non-empty. + * @return nextCursor + **/ + @ApiModelProperty(value = "Cursor to send with subsequent request to receive the next page, if non-empty.") + public String getNextCursor() { + return nextCursor; + } + + public FnList items(List items) { + this.items = items; + return this; + } + + public FnList addItemsItem(Fn itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(required = true, value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FnList fnList = (FnList) o; + return Objects.equals(this.nextCursor, fnList.nextCursor) && + Objects.equals(this.items, fnList.items); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FnList {\n"); + + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Log.java b/src/main/java/io/swagger/client/model/Log.java new file mode 100644 index 0000000..c041f4f --- /dev/null +++ b/src/main/java/io/swagger/client/model/Log.java @@ -0,0 +1,117 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * Log + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Log { + @SerializedName("call_id") + private String callId = null; + + @SerializedName("log") + private String log = null; + + public Log callId(String callId) { + this.callId = callId; + return this; + } + + /** + * Call UUID ID + * @return callId + **/ + @ApiModelProperty(value = "Call UUID ID") + public String getCallId() { + return callId; + } + + public void setCallId(String callId) { + this.callId = callId; + } + + public Log log(String log) { + this.log = log; + return this; + } + + /** + * Get log + * @return log + **/ + @ApiModelProperty(value = "") + public String getLog() { + return log; + } + + public void setLog(String log) { + this.log = log; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Log log = (Log) o; + return Objects.equals(this.callId, log.callId) && + Objects.equals(this.log, log.log); + } + + @Override + public int hashCode() { + return Objects.hash(callId, log); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Log {\n"); + + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" log: ").append(toIndentedString(log)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Stat.java b/src/main/java/io/swagger/client/model/Stat.java new file mode 100644 index 0000000..c0cf6ac --- /dev/null +++ b/src/main/java/io/swagger/client/model/Stat.java @@ -0,0 +1,119 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.StatMetrics; +import java.io.IOException; +import org.threeten.bp.OffsetDateTime; + +/** + * Stat + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Stat { + @SerializedName("timestamp") + private OffsetDateTime timestamp = null; + + @SerializedName("metrics") + private StatMetrics metrics = null; + + public Stat timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + public Stat metrics(StatMetrics metrics) { + this.metrics = metrics; + return this; + } + + /** + * Get metrics + * @return metrics + **/ + @ApiModelProperty(value = "") + public StatMetrics getMetrics() { + return metrics; + } + + public void setMetrics(StatMetrics metrics) { + this.metrics = metrics; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Stat stat = (Stat) o; + return Objects.equals(this.timestamp, stat.timestamp) && + Objects.equals(this.metrics, stat.metrics); + } + + @Override + public int hashCode() { + return Objects.hash(timestamp, metrics); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Stat {\n"); + + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/StatMetrics.java b/src/main/java/io/swagger/client/model/StatMetrics.java new file mode 100644 index 0000000..e720466 --- /dev/null +++ b/src/main/java/io/swagger/client/model/StatMetrics.java @@ -0,0 +1,278 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * StatMetrics + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class StatMetrics { + @SerializedName("net_rx") + private Long netRx = null; + + @SerializedName("net_tx") + private Long netTx = null; + + @SerializedName("mem_limit") + private Long memLimit = null; + + @SerializedName("mem_usage") + private Long memUsage = null; + + @SerializedName("disk_read") + private Long diskRead = null; + + @SerializedName("disk_write") + private Long diskWrite = null; + + @SerializedName("cpu_user") + private Long cpuUser = null; + + @SerializedName("cpu_total") + private Long cpuTotal = null; + + @SerializedName("cpu_kernel") + private Long cpuKernel = null; + + public StatMetrics netRx(Long netRx) { + this.netRx = netRx; + return this; + } + + /** + * Get netRx + * @return netRx + **/ + @ApiModelProperty(value = "") + public Long getNetRx() { + return netRx; + } + + public void setNetRx(Long netRx) { + this.netRx = netRx; + } + + public StatMetrics netTx(Long netTx) { + this.netTx = netTx; + return this; + } + + /** + * Get netTx + * @return netTx + **/ + @ApiModelProperty(value = "") + public Long getNetTx() { + return netTx; + } + + public void setNetTx(Long netTx) { + this.netTx = netTx; + } + + public StatMetrics memLimit(Long memLimit) { + this.memLimit = memLimit; + return this; + } + + /** + * Get memLimit + * @return memLimit + **/ + @ApiModelProperty(value = "") + public Long getMemLimit() { + return memLimit; + } + + public void setMemLimit(Long memLimit) { + this.memLimit = memLimit; + } + + public StatMetrics memUsage(Long memUsage) { + this.memUsage = memUsage; + return this; + } + + /** + * Get memUsage + * @return memUsage + **/ + @ApiModelProperty(value = "") + public Long getMemUsage() { + return memUsage; + } + + public void setMemUsage(Long memUsage) { + this.memUsage = memUsage; + } + + public StatMetrics diskRead(Long diskRead) { + this.diskRead = diskRead; + return this; + } + + /** + * Get diskRead + * @return diskRead + **/ + @ApiModelProperty(value = "") + public Long getDiskRead() { + return diskRead; + } + + public void setDiskRead(Long diskRead) { + this.diskRead = diskRead; + } + + public StatMetrics diskWrite(Long diskWrite) { + this.diskWrite = diskWrite; + return this; + } + + /** + * Get diskWrite + * @return diskWrite + **/ + @ApiModelProperty(value = "") + public Long getDiskWrite() { + return diskWrite; + } + + public void setDiskWrite(Long diskWrite) { + this.diskWrite = diskWrite; + } + + public StatMetrics cpuUser(Long cpuUser) { + this.cpuUser = cpuUser; + return this; + } + + /** + * Get cpuUser + * @return cpuUser + **/ + @ApiModelProperty(value = "") + public Long getCpuUser() { + return cpuUser; + } + + public void setCpuUser(Long cpuUser) { + this.cpuUser = cpuUser; + } + + public StatMetrics cpuTotal(Long cpuTotal) { + this.cpuTotal = cpuTotal; + return this; + } + + /** + * Get cpuTotal + * @return cpuTotal + **/ + @ApiModelProperty(value = "") + public Long getCpuTotal() { + return cpuTotal; + } + + public void setCpuTotal(Long cpuTotal) { + this.cpuTotal = cpuTotal; + } + + public StatMetrics cpuKernel(Long cpuKernel) { + this.cpuKernel = cpuKernel; + return this; + } + + /** + * Get cpuKernel + * @return cpuKernel + **/ + @ApiModelProperty(value = "") + public Long getCpuKernel() { + return cpuKernel; + } + + public void setCpuKernel(Long cpuKernel) { + this.cpuKernel = cpuKernel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatMetrics statMetrics = (StatMetrics) o; + return Objects.equals(this.netRx, statMetrics.netRx) && + Objects.equals(this.netTx, statMetrics.netTx) && + Objects.equals(this.memLimit, statMetrics.memLimit) && + Objects.equals(this.memUsage, statMetrics.memUsage) && + Objects.equals(this.diskRead, statMetrics.diskRead) && + Objects.equals(this.diskWrite, statMetrics.diskWrite) && + Objects.equals(this.cpuUser, statMetrics.cpuUser) && + Objects.equals(this.cpuTotal, statMetrics.cpuTotal) && + Objects.equals(this.cpuKernel, statMetrics.cpuKernel); + } + + @Override + public int hashCode() { + return Objects.hash(netRx, netTx, memLimit, memUsage, diskRead, diskWrite, cpuUser, cpuTotal, cpuKernel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatMetrics {\n"); + + sb.append(" netRx: ").append(toIndentedString(netRx)).append("\n"); + sb.append(" netTx: ").append(toIndentedString(netTx)).append("\n"); + sb.append(" memLimit: ").append(toIndentedString(memLimit)).append("\n"); + sb.append(" memUsage: ").append(toIndentedString(memUsage)).append("\n"); + sb.append(" diskRead: ").append(toIndentedString(diskRead)).append("\n"); + sb.append(" diskWrite: ").append(toIndentedString(diskWrite)).append("\n"); + sb.append(" cpuUser: ").append(toIndentedString(cpuUser)).append("\n"); + sb.append(" cpuTotal: ").append(toIndentedString(cpuTotal)).append("\n"); + sb.append(" cpuKernel: ").append(toIndentedString(cpuKernel)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/Trigger.java b/src/main/java/io/swagger/client/model/Trigger.java new file mode 100644 index 0000000..3124d1b --- /dev/null +++ b/src/main/java/io/swagger/client/model/Trigger.java @@ -0,0 +1,245 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.threeten.bp.OffsetDateTime; + +/** + * Trigger + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class Trigger { + @SerializedName("id") + private String id = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("source") + private String source = null; + + @SerializedName("fn_id") + private String fnId = null; + + @SerializedName("app_id") + private String appId = null; + + @SerializedName("annotations") + private Map annotations = null; + + @SerializedName("created_at") + private OffsetDateTime createdAt = null; + + @SerializedName("updated_at") + private OffsetDateTime updatedAt = null; + + /** + * Unique Trigger identifier. + * @return id + **/ + @ApiModelProperty(value = "Unique Trigger identifier.") + public String getId() { + return id; + } + + public Trigger name(String name) { + this.name = name; + return this; + } + + /** + * Unique name for this trigger, used to identify this trigger. + * @return name + **/ + @ApiModelProperty(value = "Unique name for this trigger, used to identify this trigger.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Trigger type(String type) { + this.type = type; + return this; + } + + /** + * Class of trigger, e.g. schedule, http, queue + * @return type + **/ + @ApiModelProperty(value = "Class of trigger, e.g. schedule, http, queue") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Trigger source(String source) { + this.source = source; + return this; + } + + /** + * URI path for this trigger. e.g. `sayHello`, `say/hello` + * @return source + **/ + @ApiModelProperty(value = "URI path for this trigger. e.g. `sayHello`, `say/hello`") + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + /** + * Opaque, unique Function identifier + * @return fnId + **/ + @ApiModelProperty(value = "Opaque, unique Function identifier") + public String getFnId() { + return fnId; + } + + /** + * Opaque, unique Application identifier + * @return appId + **/ + @ApiModelProperty(value = "Opaque, unique Application identifier") + public String getAppId() { + return appId; + } + + public Trigger annotations(Map annotations) { + this.annotations = annotations; + return this; + } + + public Trigger putAnnotationsItem(String key, Object annotationsItem) { + if (this.annotations == null) { + this.annotations = new HashMap(); + } + this.annotations.put(key, annotationsItem); + return this; + } + + /** + * Trigger annotations - this is a map of annotations attached to this trigger, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes. + * @return annotations + **/ + @ApiModelProperty(value = "Trigger annotations - this is a map of annotations attached to this trigger, keys must not exceed 128 bytes and must consist of non-whitespace printable ascii characters, and the seralized representation of individual values must not exeed 512 bytes.") + public Map getAnnotations() { + return annotations; + } + + public void setAnnotations(Map annotations) { + this.annotations = annotations; + } + + /** + * Time when trigger was created. Always in UTC. + * @return createdAt + **/ + @ApiModelProperty(value = "Time when trigger was created. Always in UTC.") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Most recent time that trigger was updated. Always in UTC. + * @return updatedAt + **/ + @ApiModelProperty(value = "Most recent time that trigger was updated. Always in UTC.") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Trigger trigger = (Trigger) o; + return Objects.equals(this.id, trigger.id) && + Objects.equals(this.name, trigger.name) && + Objects.equals(this.type, trigger.type) && + Objects.equals(this.source, trigger.source) && + Objects.equals(this.fnId, trigger.fnId) && + Objects.equals(this.appId, trigger.appId) && + Objects.equals(this.annotations, trigger.annotations) && + Objects.equals(this.createdAt, trigger.createdAt) && + Objects.equals(this.updatedAt, trigger.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, type, source, fnId, appId, annotations, createdAt, updatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Trigger {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" fnId: ").append(toIndentedString(fnId)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 "); + } + +} + diff --git a/src/main/java/io/swagger/client/model/TriggerList.java b/src/main/java/io/swagger/client/model/TriggerList.java new file mode 100644 index 0000000..39e7f8f --- /dev/null +++ b/src/main/java/io/swagger/client/model/TriggerList.java @@ -0,0 +1,116 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Trigger; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * TriggerList + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-03-27T15:47:31.669Z") +public class TriggerList { + @SerializedName("next_cursor") + private String nextCursor = null; + + @SerializedName("items") + private List items = new ArrayList(); + + /** + * Cursor to send with subsequent request to receive the next page, if non-empty. + * @return nextCursor + **/ + @ApiModelProperty(value = "Cursor to send with subsequent request to receive the next page, if non-empty.") + public String getNextCursor() { + return nextCursor; + } + + public TriggerList items(List items) { + this.items = items; + return this; + } + + public TriggerList addItemsItem(Trigger itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(required = true, value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TriggerList triggerList = (TriggerList) o; + return Objects.equals(this.nextCursor, triggerList.nextCursor) && + Objects.equals(this.items, triggerList.items); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriggerList {\n"); + + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } + +} + diff --git a/src/test/java/io/swagger/client/api/AppsApiTest.java b/src/test/java/io/swagger/client/api/AppsApiTest.java new file mode 100644 index 0000000..2b0503f --- /dev/null +++ b/src/test/java/io/swagger/client/api/AppsApiTest.java @@ -0,0 +1,120 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.App; +import io.swagger.client.model.AppList; +import io.swagger.client.model.Error; +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 AppsApi + */ +@Ignore +public class AppsApiTest { + + private final AppsApi api = new AppsApi(); + + + /** + * Create A New Application + * + * Creates a new Application, returning the complete entity. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createAppTest() throws ApiException { + App body = null; + App response = api.createApp(body); + + // TODO: test validations + } + + /** + * Delete An Application + * + * Delete the specified Application. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteAppTest() throws ApiException { + String appID = null; + api.deleteApp(appID); + + // TODO: test validations + } + + /** + * Get Information For An Application + * + * Returns more details about an Application, such as statistics. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getAppTest() throws ApiException { + String appID = null; + App response = api.getApp(appID); + + // TODO: test validations + } + + /** + * Get A List Of Applications + * + * Get a filtered list of Applications in alphabetical order. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void listAppsTest() throws ApiException { + String cursor = null; + Integer perPage = null; + String name = null; + AppList response = api.listApps(cursor, perPage, name); + + // TODO: test validations + } + + /** + * Update an Application + * + * Updates an Application via merging the provided values. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateAppTest() throws ApiException { + String appID = null; + App body = null; + App response = api.updateApp(appID, body); + + // TODO: test validations + } + +} diff --git a/src/test/java/io/swagger/client/api/CallApiTest.java b/src/test/java/io/swagger/client/api/CallApiTest.java new file mode 100644 index 0000000..08102c3 --- /dev/null +++ b/src/test/java/io/swagger/client/api/CallApiTest.java @@ -0,0 +1,92 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Call; +import io.swagger.client.model.CallList; +import io.swagger.client.model.Error; +import io.swagger.client.model.Log; +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 CallApi + */ +@Ignore +public class CallApiTest { + + private final CallApi api = new CallApi(); + + + /** + * Get call information + * + * Get call information + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fnsFnIDCallsCallIDGetTest() throws ApiException { + String fnID = null; + String callID = null; + Call response = api.fnsFnIDCallsCallIDGet(fnID, callID); + + // TODO: test validations + } + + /** + * Get a fns calls. + * + * Get a functions calls, results returned in created_at, descending order (newest first). + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fnsFnIDCallsGetTest() throws ApiException { + String fnID = null; + String cursor = null; + Integer perPage = null; + Integer fromTime = null; + Integer toTime = null; + CallList response = api.fnsFnIDCallsGet(fnID, cursor, perPage, fromTime, toTime); + + // TODO: test validations + } + + /** + * Get logs for a call. + * + * Get logs for a call. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getCallLogsTest() throws ApiException { + String fnID = null; + String callID = null; + Log response = api.getCallLogs(fnID, callID); + + // TODO: test validations + } + +} diff --git a/src/test/java/io/swagger/client/api/FnsApiTest.java b/src/test/java/io/swagger/client/api/FnsApiTest.java new file mode 100644 index 0000000..4340e0f --- /dev/null +++ b/src/test/java/io/swagger/client/api/FnsApiTest.java @@ -0,0 +1,121 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Error; +import io.swagger.client.model.Fn; +import io.swagger.client.model.FnList; +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 FnsApi + */ +@Ignore +public class FnsApiTest { + + private final FnsApi api = new FnsApi(); + + + /** + * Create A New Function + * + * Creates a new Function, returning the complete entity. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createFnTest() throws ApiException { + Fn body = null; + Fn response = api.createFn(body); + + // TODO: test validations + } + + /** + * Delete A Function + * + * Delete the specified Function. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteFnTest() throws ApiException { + String fnID = null; + api.deleteFn(fnID); + + // TODO: test validations + } + + /** + * Get Definition Of A Function + * + * Gets the definition for the Function with the specified ID. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getFnTest() throws ApiException { + String fnID = null; + Fn response = api.getFn(fnID); + + // TODO: test validations + } + + /** + * Get A list Of Functions Within An Application + * + * Get a filtered list of Functions for an Application, in alphabetical order. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void listFnsTest() throws ApiException { + String appId = null; + String cursor = null; + Integer perPage = null; + String name = null; + FnList response = api.listFns(appId, cursor, perPage, name); + + // TODO: test validations + } + + /** + * Update A Function + * + * Updates a Function via merging the provided values. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateFnTest() throws ApiException { + String fnID = null; + Fn body = null; + Fn response = api.updateFn(fnID, body); + + // TODO: test validations + } + +} diff --git a/src/test/java/io/swagger/client/api/LogApiTest.java b/src/test/java/io/swagger/client/api/LogApiTest.java new file mode 100644 index 0000000..e6989b8 --- /dev/null +++ b/src/test/java/io/swagger/client/api/LogApiTest.java @@ -0,0 +1,53 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Error; +import io.swagger.client.model.Log; +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 LogApi + */ +@Ignore +public class LogApiTest { + + private final LogApi api = new LogApi(); + + + /** + * Get logs for a call. + * + * Get logs for a call. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getCallLogsTest() throws ApiException { + String fnID = null; + String callID = null; + Log response = api.getCallLogs(fnID, callID); + + // TODO: test validations + } + +} diff --git a/src/test/java/io/swagger/client/api/TriggersApiTest.java b/src/test/java/io/swagger/client/api/TriggersApiTest.java new file mode 100644 index 0000000..d0b3007 --- /dev/null +++ b/src/test/java/io/swagger/client/api/TriggersApiTest.java @@ -0,0 +1,122 @@ +/* + * fn + * The open source serverless platform. + * + * OpenAPI spec version: 2.0.0 + * + * + * 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 io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Error; +import io.swagger.client.model.Trigger; +import io.swagger.client.model.TriggerList; +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 TriggersApi + */ +@Ignore +public class TriggersApiTest { + + private final TriggersApi api = new TriggersApi(); + + + /** + * Create A New Trigger. + * + * Creates a new Trigger, returning the complete entity. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createTriggerTest() throws ApiException { + Trigger body = null; + Trigger response = api.createTrigger(body); + + // TODO: test validations + } + + /** + * Delete A Trigger + * + * Delete the specified Trigger. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteTriggerTest() throws ApiException { + String triggerID = null; + api.deleteTrigger(triggerID); + + // TODO: test validations + } + + /** + * Get Definition Of A Trigger + * + * Gets the definition for the Trigger with the specified ID. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getTriggerTest() throws ApiException { + String triggerID = null; + Trigger response = api.getTrigger(triggerID); + + // TODO: test validations + } + + /** + * Get A List Of Triggers Within An Application Or Function + * + * This will list all Triggers for a particular Application or Function, returned in name alphabetical order. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void listTriggersTest() throws ApiException { + String appId = null; + String fnId = null; + String cursor = null; + Integer perPage = null; + String name = null; + TriggerList response = api.listTriggers(appId, fnId, cursor, perPage, name); + + // TODO: test validations + } + + /** + * Update A Trigger + * + * Updates a Trigger by merging the provided values. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateTriggerTest() throws ApiException { + String triggerID = null; + Trigger body = null; + Trigger response = api.updateTrigger(triggerID, body); + + // TODO: test validations + } + +}