com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria Maven / Gradle / Ivy
/*
* Copyright (c) 2022 Asynchronous Game Query Library
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibasco.agql.protocols.supercell.coc.webapi;
import com.ibasco.agql.protocols.supercell.coc.webapi.enums.CocWarFrequency;
import org.jetbrains.annotations.ApiStatus;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* A Builder class for Clan Search Criteria
*
* @author Rafael Luis Ibasco
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public class CocSearchCriteria {
private final Map criteria = new HashMap<>();
/**
* A factory method to create a {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public static CocSearchCriteria create() {
return new CocSearchCriteria();
}
/**
*
* Search clans by name. If name is used as part of search query, it needs to be at least three characters long.
* Name search parameter is interpreted as wild card search, so it may appear anywhere in the clan name.
*
*
* @param name
* a {@link java.lang.String} object
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria name(String name) {
criteria.put("name", name);
return this;
}
/**
* Filter by clan war frequency
*
* @param frequency
* a {@link com.ibasco.agql.protocols.supercell.coc.webapi.enums.CocWarFrequency} object
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria warFrequency(CocWarFrequency frequency) {
criteria.put("warFrequency", frequency.getCode());
return this;
}
/**
* Filter by clan location identifier. For list of available locations, refer to getLocations operation.
*
* @param locationId
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria locationId(int locationId) {
criteria.put("locationId", locationId);
return this;
}
/**
* Filter by minimum amount of clan members.
*
* @param minMembers
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria minMembers(int minMembers) {
criteria.put("minMembers", minMembers);
return this;
}
/**
* Filter by maximum amount of clan members.
*
* @param maxMembers
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria maxMembers(int maxMembers) {
criteria.put("maxMembers", maxMembers);
return this;
}
/**
* Filter by minimum amount of clan points.
*
* @param minClanPoints
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria minClanPoints(int minClanPoints) {
criteria.put("minClanPoints", minClanPoints);
return this;
}
/**
* Filter by minimum clan level.
*
* @param minClanLevel
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria minClanLevel(int minClanLevel) {
criteria.put("minClanLevel", minClanLevel);
return this;
}
/**
* Limit the number of items returned in the response.
*
* @param limit
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria limit(int limit) {
criteria.put("limit", limit);
return this;
}
/**
*
* Return only items that occur after this marker. After marker can be found from the response, inside the 'paging'
* property.
* Note that only after or before can be specified for a request, not both.
*
*
* @param after
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria after(int after) {
criteria.put("after", after);
return this;
}
/**
*
* Return only items that occur before this marker. Before marker can be found from the response, inside the
* 'paging' property.
* Note that only after or before can be specified for a request, not both.
*
*
* @param before
* a int
*
* @return A {@link com.ibasco.agql.protocols.supercell.coc.webapi.CocSearchCriteria} instance
*/
public CocSearchCriteria before(int before) {
criteria.put("before", before);
return this;
}
/**
* Returns the underlying set containing all the search criterias
*
* @return A {@link java.util.Set} containing all the search criterias wrapped within a {@link java.util.Map.Entry}
*/
public Set> getCriteriaSet() {
return criteria.entrySet();
}
}