Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsequeira committed May 16, 2018
1 parent 11acf4f commit 8aff9b1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/bynder/sdk/query/ConversionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
* Enum to represent the type of conversion.
*/
public enum ConversionType {
LIST_FIELD, METAPROPERTY_FIELD, JSON_FIELD, BOOLEAN_FIELD, NONE
METAPROPERTY_MAP_FIELD, LIST_FIELD, METAPROPERTY_FIELD, JSON_FIELD, BOOLEAN_FIELD, NONE
}
17 changes: 16 additions & 1 deletion src/main/java/com/bynder/sdk/query/MediaQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.bynder.sdk.model.MediaType;
import java.util.List;
import java.util.Map;

/**
* Query to filter media results.
Expand Down Expand Up @@ -43,7 +44,7 @@ public class MediaQuery {
@ApiField(name = "page")
private Integer page;
/**
* Metaproperty option ids that the media asset has to have.
* Metaproperty option ids that the media asset needs to have at least one of.
*/
@ApiField(name = "propertyOptionId", conversionType = ConversionType.LIST_FIELD)
private List<String> propertyOptionIds;
Expand All @@ -52,6 +53,11 @@ public class MediaQuery {
*/
@ApiField(name = "orderBy")
private OrderBy orderBy;
/**
* Metaproperty option ids that the media asset has to have.
*/
@ApiField(name = "property", conversionType = ConversionType.METAPROPERTY_MAP_FIELD)
private Map<String, String> metapropertyOptions;

public MediaType getType() {
return type;
Expand Down Expand Up @@ -115,4 +121,13 @@ public MediaQuery setOrderBy(final OrderBy orderBy) {
this.orderBy = orderBy;
return this;
}

public Map<String, String> getMetapropertyOptions() {
return metapropertyOptions;
}

public MediaQuery setMetapropertyOptions(final Map<String, String> metapropertyOptions) {
this.metapropertyOptions = metapropertyOptions;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public Observable<UploadProgress> uploadFileWithProgress(final UploadQuery uploa
});
} else {
observableEmitter.onError(new BynderUploadException(
"Converter did not finishe. Upload not "
"Converter did not finished. Upload not "
+ "completed."));
}
}, throwable -> observableEmitter.onError(throwable));
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/bynder/sdk/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ private static void convertField(final Field field, final Object query,
} else if (apiField.conversionType() == ConversionType.BOOLEAN_FIELD) {
Boolean booleanField = (Boolean) field.get(query);
params.put(apiField.name(), booleanField ? "1" : "0");
} else if (apiField.conversionType() == ConversionType.METAPROPERTY_MAP_FIELD) {
Map<?, ?> listField = (Map<?, ?>) field.get(query);
listField.entrySet().forEach(entry -> params
.put(String.format("%s_%s", apiField.name(), entry.getKey().toString()),
entry.getValue().toString()));
}
}
}
Expand Down

0 comments on commit 8aff9b1

Please sign in to comment.