Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #123

Merged
merged 9 commits into from
Jul 23, 2024
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v1.14.2

### Date: 15-July-2024

-Enhancement: Fetch assets using any field uid of assets

## v1.14.1

### Date: 17-May-2024
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.contentstack.sdk</groupId>
<artifactId>java</artifactId>
<version>1.14.1</version>
<version>1.14.2</version>
<packaging>jar</packaging>
<name>contentstack-java</name>
<description>Java SDK for Contentstack Content Delivery API</description>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/contentstack/sdk/AssetLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,11 @@ public enum ORDERBY {
ASCENDING, DESCENDING
}

public AssetLibrary where(String key, String value) {
JSONObject queryParams= new JSONObject();
queryParams.put(key,value);
urlQueries.put("query", queryParams);
return this;
}

}
2 changes: 1 addition & 1 deletion src/main/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="text/html; charset=utf-8"/>
<title>Welcome file</title>
<link rel="stylesheet" href="https://stackedit.io/style.css"/>
<link rel="stylesheet" href="style.css" integrity="sha384-4bNdbyOskJgh/Rv7MV6pG3Dlfd2EI7sPBtOvLN3Wh9/ixTPwuXfizfkYukM2tyWL%" crossorigin="anonymous"/>
</head>

<body class="stackedit">
Expand Down
1 change: 1 addition & 0 deletions src/main/style.css

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/test/java/com/contentstack/sdk/TestAssetLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.*;


import java.util.List;
import java.util.logging.Logger;

Expand Down Expand Up @@ -95,4 +96,15 @@ void testIncludeOwner() {
AssetLibrary assetLibrary = stack.assetLibrary().includeMetadata();
Assertions.assertFalse(assetLibrary.headers.containsKey("include_owner"));
}

@Test
void testAssetQueryOtherThanUID() {
AssetLibrary query = stack.assetLibrary().where("tags","tag1");
query.fetchAll(new FetchAssetsCallback() {
@Override
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
System.out.println(assets);
}
});
}
}
Loading