Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@
.metadata
bin/
tmp/
apidoc/
*.tmp
*.bak
*.swp
Expand DownExpand Up@@ -198,4 +199,5 @@ dependency-reduced-pom.xml
README.html
*.iml
.idea
.exercism
.exercism
/apidoc/
95 changes: 39 additions & 56 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,90 +8,73 @@ Before using the **Marketplace** SDK, ensure the following:

1. Java JDK 1.8 or above should be installed on your machine.
2. You have a valid Contentstack account with access to the Contentstack Marketplace.
3. You have obtained the necessary credentials, including the organization UID, to interact with the Marketplace API.
3. You have obtained the necessary credentials like **organization UID** and **authtoken**, to interact with the Marketplace API.

## Installation

To use the Marketplace SDK in your Java project, follow these steps:

1. Download the contentstack-java SDK and its dependencies from the Contentstack Maven repository. Add the following dependencies to your project's pom.xml file:

```xml
<!-- https://mvnrepository.com/artifact/com.contentstack.sdk/marketplace -->
<dependencies>
<dependency>
<groupId>com.contentstack.sdk</groupId>
<artifactId>marketplace</artifactId>
<version>x.x.x</version> <!-- Replace 'x.x.x' with the latest version available -->
</dependency>
</dependencies>
```
```xml
<!-- https://mvnrepository.com/artifact/com.contentstack.sdk/marketplace -->
<dependencies>
<dependency> <groupId>com.contentstack.sdk</groupId> <artifactId>marketplace</artifactId> <version>x.x.x</version> <!-- Replace 'x.x.x' with the latest version available --> </dependency></dependencies>
```

2. Save the pom.xml file.

3. Ensure you have internet connectivity to download the SDK and its dependencies from the central Maven repository.

## How to Use

1. Import the required packages:
1. Initialize the Marketplace class with your organization UID:

```java
```java
import com.contentstack.sdk.marketplace.Marketplace;
import com.contentstack.sdk.marketplace.apps.App;
import com.contentstack.sdk.marketplace.auths.Auth;
import com.contentstack.sdk.marketplace.installations.Installation;
import com.contentstack.sdk.marketplace.request.AppRequest;
import org.jetbrains.annotations.NotNull;
import retrofit2.Retrofit;
```

2. Initialize the Marketplace class with your organization UID:

```java
// Replace 'YOUR_ORG_ID' with your Contentstack organization UID
String organizationUid = "YOUR_ORG_ID";
Marketplace marketplace = new Marketplace(organizationUid);
```
Marketplace marketplace = new Marketplace
.Builder(TestClient.ORGANIZATION_UID) // Required
.host(HOST) // Optional
.authtoken("test") // Optional
.login("test@email.com", "*********") // Optional
.region(Region.AZURE_EU) // Optional
.build();
```

3. Use the various methods available in the Marketplace class to interact with the Marketplace API:
2. Use the various methods available in the Marketplace class to interact with the Marketplace API:

### Retrieve an instance of the App class:

```java
// Get an instance of the App class
App app = marketplace.app();

// Alternatively, you can pass the app UID to retrieve a specific app
String appUid = "APP_UID";
App specificApp = marketplace.app(appUid);
```
Get an instance of the App class
```java
import com.contentstack.sdk.marketplace.apps.App;
App app = marketplace.app();
// Alternatively, you can pass the app UID to retrieve a specific app
App specificApp = marketplace.app("APP_UID");
```

### Retrieve an instance of the Auth class:

```java
// Get an instance of the Auth class
Auth auth = marketplace.authorizations();
```
import com.contentstack.sdk.marketplace.auths.Auth;
// Get an instance of the Auth class
Auth auth = marketplace.authorizations();
```

### Retrieve an instance of the Installation class:

Get an instance of the Installation class
```java
// Get an instance of the Installation class
Installation installation = marketplace.installation();

// Alternatively, you can pass the installation ID to retrieve a specific installation
String installationId = "INSTALLATION_ID";
Installation specificInstallation = marketplace.installation(installationId);
```
import com.contentstack.sdk.marketplace.installations.Installation;
Installation installation = marketplace.installation();
OR
Installation specificInstallation = marketplace.installation("INSTALLATION_ID");
```

### Create an instance of the AppRequest class:

Get an instance of the AppRequest class
```java
// Get an instance of the AppRequest class
AppRequest appRequest = marketplace.request();
```

**Note:** Replace **YOUR_ORG_ID**, **APP_UID**, and **INSTALLATION_ID** with actual values from your Contentstack organization.
import com.contentstack.sdk.marketplace.request.AppRequest;
AppRequest appRequest = marketplace.request();
```

## License

Expand All@@ -102,4 +85,4 @@ Copyright © 2012-2023 [Contentstack](https://www.contentstack.com/). All Rights
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.
```
```
22 changes: 11 additions & 11 deletions pom.xml
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.contentstack.sdk</groupId>
<artifactId>marketplace</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>
<description>Contentstack Java Management SDK for Content Management API</description>
<url>https://github.com/contentstack/contentstack-management-java/</url>

Expand All@@ -14,25 +14,25 @@
<maven.compiler.target>9</maven.compiler.target>
<maven.compiler.source>9</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire-report-plugin.version>2.22.0</surefire-report-plugin.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<surefire-report-plugin.version>3.1.2</surefire-report-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
<dotenv-source.version>5.2.2</dotenv-source.version>
<rxjava-source.version>3.1.6</rxjava-source.version>
<retrofit-source.version>2.7.0</retrofit-source.version>
<retrofit-source.version>2.9.0</retrofit-source.version>
<converter-gson-version>2.9.0</converter-gson-version>
<logging.version>4.10.0</logging.version>
<jococo-plugin.version>0.8.7</jococo-plugin.version>
<lombok-source.version>1.18.28</lombok-source.version>
<junit-jupiter.version>5.9.2</junit-jupiter.version>
<lombok-source.version>1.18.30</lombok-source.version>
<junit-jupiter.version>5.10.0</junit-jupiter.version>
<junit-jupiter-engine.version>5.8.0-M1</junit-jupiter-engine.version>
<junit-vintage-engine.version>5.9.2</junit-vintage-engine.version>
<junit-vintage-engine.version>5.10.0</junit-vintage-engine.version>
<gson.version>2.10.1</gson.version>
<maven-site-plugin.version>3.3</maven-site-plugin.version>
<maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-site-plugin.version>4.0.0-M9</maven-site-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
</properties>


Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/contentstack/sdk/marketplace/Constants.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
package com.contentstack.sdk.marketplace;

public class Constants {
final public static String ERROR_NO_ORGANIZATION_UID = "Organization uid could not be empty";
final public static String DEFAULT_HOST = "developerhub-api.contentstack.com";
final public static String MISSING_ORG_ID = "organization uid is required";


final public static String ORGANIZATION_UID = "organization_uid";
final public static String AUTHTOKEN = "authtoken";
}
Loading