Skip to content

Clan search

ClanSearchRequest

Bases: IterRequestModel

Search all clans by name and/or filtering the results using various criteria. At least one filtering criteria must be defined and if name is used as part of search, it is required to be at least three characters long. It is not possible to specify ordering for results so clients should not rely on any specific ordering as that may change in the future releases of the API.

Source code in pyclasher/api/requests/clan_search.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class ClanSearchRequest(IterRequestModel):
    """
    Search all clans by name and/or filtering the results using various criteria.
    At least one filtering criteria must be defined and if name is used as part of search,
    it is required to be at least three characters long. It is not possible to specify
    ordering for results so clients should not rely on any specific ordering as that may
    change in the future releases of the API.
    """

    clan_name = None
    _iter_rtype = Clan
    _list_rtype = ClanList

    def __init__(
            self,
            name=None,
            war_frequency=None,
            location=None,
            min_members=None,
            max_members=None,
            min_clan_points=None,
            min_clan_level=None,
            label_ids=None,
            limit=None,
            after=None,
            before=None
    ) -> None:
        """
        initialisation of the clan request
        :param name:            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.
        :type name:             str
        :param war_frequency:   Filter by clan war frequency
        :type war_frequency:    WarFrequency
        :param location:     Filter by clan location identifier. For list of available locations, refer to getLocations operation.
        :type location:      Locations
        :param min_members:     Filter by minimum number of clan members
        :type min_members:      int
        :param max_members:     Filter by maximum number of clan members
        :type max_members:      int
        :param min_clan_points: Filter by minimum amount of clan points.
        :type min_clan_points:  int
        :param min_clan_level:  Filter by minimum clan level.
        :type min_clan_level:   int
        :param label_ids:       Comma separated list of label IDs to use for filtering results.
        :type label_ids:        list[Labels]
        :param limit:           Limit the number of items returned in the response.
        :type limit:            int
        :param after:           Return only items that occur after 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.
        :type after:            str
        :param before:          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.
        :type before:           str
        """

        self.clan_name = name
        IterRequestModel.__init__(
            self,
            "clans",
            kwargs={
                'name': name,
                'warFrequency': (war_frequency.value
                                 if war_frequency is not None else None),
                'locationId': (location.value.id
                               if location is not None else None),
                'minMembers': min_members,
                'maxMembers': max_members,
                'minClanPoints': min_clan_points,
                'minClanLevel': min_clan_level,
                'labelIds': ",".join(
                    (label.value.id for label in
                     label_ids)) if label_ids is not None else None,
                'limit': limit, 'after': after,
                'before': before
            }
        )
        return

__init__(name=None, war_frequency=None, location=None, min_members=None, max_members=None, min_clan_points=None, min_clan_level=None, label_ids=None, limit=None, after=None, before=None)

initialisation of the clan request :param name: 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. :type name: str :param war_frequency: Filter by clan war frequency :type war_frequency: WarFrequency :param location: Filter by clan location identifier. For list of available locations, refer to getLocations operation. :type location: Locations :param min_members: Filter by minimum number of clan members :type min_members: int :param max_members: Filter by maximum number of clan members :type max_members: int :param min_clan_points: Filter by minimum amount of clan points. :type min_clan_points: int :param min_clan_level: Filter by minimum clan level. :type min_clan_level: int :param label_ids: Comma separated list of label IDs to use for filtering results. :type label_ids: list[Labels] :param limit: Limit the number of items returned in the response. :type limit: int :param after: Return only items that occur after 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. :type after: str :param before: 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. :type before: str

Source code in pyclasher/api/requests/clan_search.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
def __init__(
        self,
        name=None,
        war_frequency=None,
        location=None,
        min_members=None,
        max_members=None,
        min_clan_points=None,
        min_clan_level=None,
        label_ids=None,
        limit=None,
        after=None,
        before=None
) -> None:
    """
    initialisation of the clan request
    :param name:            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.
    :type name:             str
    :param war_frequency:   Filter by clan war frequency
    :type war_frequency:    WarFrequency
    :param location:     Filter by clan location identifier. For list of available locations, refer to getLocations operation.
    :type location:      Locations
    :param min_members:     Filter by minimum number of clan members
    :type min_members:      int
    :param max_members:     Filter by maximum number of clan members
    :type max_members:      int
    :param min_clan_points: Filter by minimum amount of clan points.
    :type min_clan_points:  int
    :param min_clan_level:  Filter by minimum clan level.
    :type min_clan_level:   int
    :param label_ids:       Comma separated list of label IDs to use for filtering results.
    :type label_ids:        list[Labels]
    :param limit:           Limit the number of items returned in the response.
    :type limit:            int
    :param after:           Return only items that occur after 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.
    :type after:            str
    :param before:          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.
    :type before:           str
    """

    self.clan_name = name
    IterRequestModel.__init__(
        self,
        "clans",
        kwargs={
            'name': name,
            'warFrequency': (war_frequency.value
                             if war_frequency is not None else None),
            'locationId': (location.value.id
                           if location is not None else None),
            'minMembers': min_members,
            'maxMembers': max_members,
            'minClanPoints': min_clan_points,
            'minClanLevel': min_clan_level,
            'labelIds': ",".join(
                (label.value.id for label in
                 label_ids)) if label_ids is not None else None,
            'limit': limit, 'after': after,
            'before': before
        }
    )
    return