All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala-akka-client.README.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
# {{artifactId}}

{{appName}}
- API version: {{appVersion}}
{{^hideGenerationTimestamp}}
  - Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
  - Generator version: {{generatorVersion}}

{{{appDescriptionWithNewLines}}}

{{#infoUrl}}
  For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}

*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*

## Requirements

Building the API client library requires:
1. Java 1.7+
2. Maven/Gradle/SBT

## Installation

To install the API client library to your local Maven repository, simply execute:

```shell
mvn clean install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell
mvn clean deploy
```

Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.

### Maven users

Add this dependency to your project's POM:

```xml

  {{{groupId}}}
  {{{artifactId}}}
  {{{artifactVersion}}}
  compile

```

### Gradle users

Add this dependency to your project's build file:

```groovy
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
```

### SBT users

```scala
libraryDependencies += "{{{groupId}}}" % "{{{artifactId}}}" % "{{{artifactVersion}}}"
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```scala
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
import {{invokerPackage}}._
import {{modelPackage}}._
import {{{package}}}.{{{classname}}}

import akka.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object {{{classname}}}Example extends App {

    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher{{#hasAuthMethods}}
    {{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
    // Configure HTTP basic authorization: {{{name}}}
    implicit val {{{name}}}: BasicCredentials = BasicCredentials("YOUR USERNAME", "YOUR PASSWORD"){{/isBasicBasic}}{{#isBasicBearer}}
    // Configure HTTP bearer authorization: {{{name}}}
    implicit val {{{name}}}: BearerToken = BearerToken("BEARER TOKEN"){{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
    // Configure API key authorization: {{{name}}}
    implicit val {{{name}}}: ApiKeyValue = ApiKeyValue("YOUR API KEY"){{/isApiKey}}
    {{/authMethods}}
    {{/hasAuthMethods}}

    // Create invoker to execute requests
    val apiInvoker = ApiInvoker()
    val apiInstance = {{{classname}}}("{{{basePath}}}"){{#allParams}}
    val {{{paramName}}}: {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}}
    {{/allParams}}

    val request = apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(org.openapitools.client.core.ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}"){{#returnType}}
            System.out.println(s"Response body: $content"){{/returnType}}

        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) =>
            System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}")
            exception.printStackTrace();
    }

}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```

## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation for Models

{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}


## Documentation for Authorization

{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{#authMethods}}

### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}  - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}

## Author

{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy