in src/main/java/com/microsoft/store/partnercenter/relationships/RelationshipCollectionOperations.java [76:119]
public ResourceCollection<PartnerRelationship> Query(PartnerRelationshipType partnerRelationshipType, IQuery query)
{
if (query.getType() != QueryType.SIMPLE)
{
throw new IllegalArgumentException("This type of query is not supported.");
}
Collection<KeyValuePair<String, String>> parameters = new ArrayList<KeyValuePair<String, String>>();
if (query.getFilter() != null)
{
// add the filter to the request if specified
ObjectMapper mapper = new ObjectMapper();
try
{
parameters.add
(
new KeyValuePair<String, String>
(
PartnerService.getInstance().getConfiguration().getApis().get("GetPartnerRelationships").getParameters().get("Filter"),
URLEncoder.encode
(
mapper.writeValueAsString(query.getFilter()),
"UTF-8"
)
)
);
}
catch(JsonProcessingException e)
{
throw new PartnerException("", null, PartnerErrorCategory.REQUEST_PARSING, e);
}
catch (UnsupportedEncodingException e)
{
throw new PartnerException("", null, PartnerErrorCategory.REQUEST_PARSING, e);
}
}
return this.getPartner().getServiceClient().get(
this.getPartner(),
new TypeReference<ResourceCollection<PartnerRelationship>>(){},
PartnerService.getInstance().getConfiguration().getApis().get("GetPartnerRelationships").getPath(),
parameters);
}