Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
louismrose committed Mar 18, 2024
0 parents commit 964f1c3
Show file tree
Hide file tree
Showing 87 changed files with 14,796 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.idea
target
*.class
*.jar
.openapi-generator
docker-compose.override.yml
spec.yaml
TODO.md
15 changes: 15 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.github/**
api/**
docs/**
gradle/**
src/test/**
.gitignore
.travis.yml
build.gradle
build.sbt
git_push.sh
gradle.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:8

# Add maven
RUN apt-get update && apt-get install -y maven gnupg
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Zamzar Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.PHONY: up clean sync generate build test bump publish

SPEC_REMOTE = https://raw.githubusercontent.com/zamzar/zamzar-spec/main/openapi/spec.yaml
SPEC = spec.yaml
GENERATOR_CMD = docker compose exec codegen \
java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar
GENERATE_ARGS = generate -i $(SPEC) -g java -c openapi-generator-config.yaml
MVN_CMD = docker compose exec maven mvn --batch-mode --no-transfer-progress

up:
@docker compose up -d

clean:
@while read -r generated; do rm -f "$$generated" || true; done < .openapi-generator/FILES
@rm -rf target

sync:
@curl -sSL $(SPEC_REMOTE) > $(SPEC)

generate: up
@$(eval VERSION=$(shell $(MVN_CMD) help:evaluate -Dexpression=project.version -q -DforceStdout))
@$(GENERATOR_CMD) $(GENERATE_ARGS) --additional-properties=artifactVersion=$(VERSION)

build: generate
@$(MVN_CMD) clean test-compile

test: build
@$(MVN_CMD) test

bump: up
ifndef VERSION
$(error VERSION is not set)
endif
@$(MVN_CMD) versions:set -DnewVersion=$(VERSION) versions:commit
@$(GENERATOR_CMD) $(GENERATE_ARGS) --additional-properties=artifactVersion=$(VERSION)

publish:
ifndef MVN_CENTRAL_USERNAME
$(error MVN_CENTRAL_USERNAME is not set)
endif
ifndef MVN_CENTRAL_PASSWORD
$(error MVN_CENTRAL_PASSWORD is not set)
endif
ifndef GPG_PRIVATE_KEY_PATH
$(error GPG_PRIVATE_KEY_PATH is not set)
endif
ifndef GPG_PASSPHRASE
$(error GPG_PASSPHRASE is not set)
endif
@docker compose exec maven mkdir -p /root/.m2
@docker compose exec maven sh -c 'echo "<settings><servers><server><id>central</id><username>$(MVN_CENTRAL_USERNAME)</username><password>$(MVN_CENTRAL_PASSWORD)</password></server></servers></settings>" > /root/.m2/settings.xml'
@docker compose cp $(GPG_PRIVATE_KEY_PATH) maven:/root/api-sdks.asc
@docker compose exec maven gpg --batch --import --pinentry-mode loopback --passphrase "$(GPG_PASSPHRASE)" /root/api-sdks.asc
@$(MVN_CMD) deploy -DskipTests -Dgpg.keyname=api-sdks -Dgpg.passphrase=$(GPG_PASSPHRASE)
179 changes: 179 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# zamzar-java

Zamzar API
- API version: 0.0.2

Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.


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


## Requirements

Building the API client library requires:
1. Java 1.8+
2. Maven (3.8.3+)/Gradle (7.2+)

## 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
<dependency>
<groupId>com.zamzar</groupId>
<artifactId>zamzar-java</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy
repositories {
mavenCentral() // Needed if the 'zamzar-java' jar has been published to maven central.
mavenLocal() // Needed if the 'zamzar-java' jar has been published to the local maven repo.
}
dependencies {
implementation "com.zamzar:zamzar-java:0.0.1"
}
```

### Others

At first generate the JAR by executing:

```shell
mvn clean package
```

Then manually install the following JARs:

* `target/zamzar-java-0.0.1.jar`
* `target/lib/*.jar`

## Getting Started

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

```java

// Import classes:
import com.zamzar.api.invoker.ApiClient;
import com.zamzar.api.invoker.ApiException;
import com.zamzar.api.invoker.Configuration;
import com.zamzar.api.invoker.auth.*;
import com.zamzar.api.invoker.models.*;
import com.zamzar.api.core.AccountApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.zamzar.com/v1");

// Configure HTTP bearer authorization: ApiKeyAuth
HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setBearerToken("BEARER TOKEN");

AccountApi apiInstance = new AccountApi(defaultClient);
try {
Account result = apiInstance.getAccount();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccountApi#getAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

```

## Documentation for API Endpoints

All URIs are relative to *https://api.zamzar.com/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountApi* | [**getAccount**](docs/AccountApi.md#getAccount) | **GET** /account | Retrieve account information
*FilesApi* | [**deleteFileById**](docs/FilesApi.md#deleteFileById) | **DELETE** /files/{fileId} | Delete a file
*FilesApi* | [**getFileById**](docs/FilesApi.md#getFileById) | **GET** /files/{fileId} | Retrieve metadata for a specific file
*FilesApi* | [**getFileContentById**](docs/FilesApi.md#getFileContentById) | **GET** /files/{fileId}/content | Retrieve the content of a file
*FilesApi* | [**listFiles**](docs/FilesApi.md#listFiles) | **GET** /files | Retrieve a list of files
*FilesApi* | [**uploadFile**](docs/FilesApi.md#uploadFile) | **POST** /files | Upload a file
*FormatsApi* | [**getFormatById**](docs/FormatsApi.md#getFormatById) | **GET** /formats/{format} | Retrieve a specific format
*FormatsApi* | [**listFormats**](docs/FormatsApi.md#listFormats) | **GET** /formats | List all formats
*ImportsApi* | [**getImportById**](docs/ImportsApi.md#getImportById) | **GET** /imports/{importId} | Retrieve a specific import
*ImportsApi* | [**listImports**](docs/ImportsApi.md#listImports) | **GET** /imports | Retrieve a list of all imports
*ImportsApi* | [**startImport**](docs/ImportsApi.md#startImport) | **POST** /imports | Start an Import
*JobsApi* | [**cancelJobById**](docs/JobsApi.md#cancelJobById) | **DELETE** /jobs/{jobId} | Cancel a job
*JobsApi* | [**getJobById**](docs/JobsApi.md#getJobById) | **GET** /jobs/{jobId} | Retrieve a specific job
*JobsApi* | [**listJobs**](docs/JobsApi.md#listJobs) | **GET** /jobs | Retrieve a list of all jobs
*JobsApi* | [**submitJob**](docs/JobsApi.md#submitJob) | **POST** /jobs | Submit a conversion job
*WelcomeApi* | [**welcome**](docs/WelcomeApi.md#welcome) | **GET** / | Welcome


## Documentation for Models

- [Account](docs/Account.md)
- [AccountPlan](docs/AccountPlan.md)
- [Error](docs/Error.md)
- [ErrorContext](docs/ErrorContext.md)
- [Errors](docs/Errors.md)
- [Export](docs/Export.md)
- [Failure](docs/Failure.md)
- [Files](docs/Files.md)
- [Format](docs/Format.md)
- [FormatTargetsInner](docs/FormatTargetsInner.md)
- [Formats](docs/Formats.md)
- [Imports](docs/Imports.md)
- [Job](docs/Job.md)
- [Jobs](docs/Jobs.md)
- [ModelFile](docs/ModelFile.md)
- [ModelImport](docs/ModelImport.md)
- [PagingNumeric](docs/PagingNumeric.md)
- [PagingString](docs/PagingString.md)
- [Welcome200Response](docs/Welcome200Response.md)


<a id="documentation-for-authorization"></a>
## Documentation for Authorization


Authentication schemes defined for the API:
<a id="ApiKeyAuth"></a>
### ApiKeyAuth

- **Type**: HTTP Bearer Token authentication


## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## Author

[email protected]

23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3'
services:
codegen:
entrypoint: [ "/bin/sh", "-c", "sleep infinity" ]
image: 'openapitools/openapi-generator-cli:v7.3.0'
volumes:
- '.:/local'
working_dir: '/local'
maven:
build: .
depends_on:
- mock
entrypoint: [ "/bin/sh", "-c", "sleep infinity" ]
environment:
- API_KEY=GiVUYsF4A8ssq93FR48H
- API_URL=http://mock:8080
volumes:
- '.:/usr/src/zamzar-java'
working_dir: '/usr/src/zamzar-java'
mock:
image: zamzar/zamzar-mock:latest
ports:
- "8080:8080"
21 changes: 21 additions & 0 deletions openapi-generator-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
additionalProperties:
apiPackage: com.zamzar.api.core
artifactDescription: Java SDK for the Zamzar API
artifactId: zamzar-java
artifactUrl: https://github.com/zamzar/zamzar-java
developerEmail: [email protected]
developerName: Zamzar
developerOrganization: Zamzar Ltd
developerOrganizationUrl: https://github.com/zamzar
groupId: com.zamzar
hideGenerationTimestamp: true
modelPackage: com.zamzar.api.model
invokerPackage: com.zamzar.api.invoker
licenseName: MIT
licenseUrl: https://opensource.org/licenses/MIT
scmConnection: scm:git:git://github.com/zamzar/zamzar-java.git
scmDeveloperConnection: scm:git:ssh://github.com:zamzar/zamzar-java.git
scmUrl: https://github.com/zamzar/zamzar-java

apiTests: false
modelTests: false
Loading

0 comments on commit 964f1c3

Please sign in to comment.