diff --git a/src/application.wadl b/src/application.wadl index 95f271ca1c368d36f37c2f4e48468f96372daf99..f3545eba4bd9d48c1814307e0c1d0a05ee798bb7 100644 --- a/src/application.wadl +++ b/src/application.wadl @@ -1071,6 +1071,48 @@ </response> </method> </resource> + <resource path="all-people"> + <method id="allPeople" name="GET" resultField="people:java.util.List<IbisPerson>"> + <doc> + /** + * Return a list of all people (in batches). + * <p> + * The results are sorted by identifier, starting with the first person + * after the person with the specified identifier. Thus, to iterate over + * all people, pass a {@code null} identifier to get the first batch of + * people, then pass the last identifier from the previous batch to get + * the next batch, and repeat until no more people are returned. + * <p> + * By default, only a few basic details about each person are returned, + * but the optional <code>fetch</code> parameter may be used to fetch + * additional attributes or references. + * + * @param includeCancelled [optional] Flag to allow cancelled people to + * be included (people who are no longer members of the University). + * Defaults to {@code false}. + * @param identifier [optional] The identifier (CRSid) of the person to + * start after, or {@code null} to start from the first person. + * @param limit [optional] The maximum number of people to return. + * Defaults to 100. + * @param fetch [optional] A comma-separated list of any additional + * attributes or references to fetch. + * + * @return The requested people (in identifier order). + */</doc> + <request> + <param name="includeCancelled" style="query" type="xs:boolean" javaType="boolean" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> + <param name="identifier" style="query" type="xs:string" javaType="java.lang.String" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> + <param name="limit" style="query" type="xs:int" javaType="int" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> + <param name="fetch" style="query" type="xs:string" javaType="java.util.List" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> + </request> + <response> + <representation mediaType="application/xml"/> + <representation mediaType="application/json"/> + <representation mediaType="text/xml"/> + <representation mediaType="text/x-json"/> + </response> + </method> + </resource> <resource path="list"> <method id="listPeople" name="GET" resultField="people:java.util.List<IbisPerson>"> <doc> diff --git a/src/java/uk/ac/cam/ucs/ibis/methods/PersonMethods.java b/src/java/uk/ac/cam/ucs/ibis/methods/PersonMethods.java index 96022d62123314b0339911fdefa339637a66d4b4..4b18c787a99dd0500a2d9538d31fae20e8c05e02 100644 --- a/src/java/uk/ac/cam/ucs/ibis/methods/PersonMethods.java +++ b/src/java/uk/ac/cam/ucs/ibis/methods/PersonMethods.java @@ -175,6 +175,55 @@ public class PersonMethods return result.attributeSchemes; } + /** + * Return a list of all people (in batches). + * <p> + * The results are sorted by identifier, starting with the first person + * after the person with the specified identifier. Thus, to iterate over + * all people, pass a {@code null} identifier to get the first batch of + * people, then pass the last identifier from the previous batch to get + * the next batch, and repeat until no more people are returned. + * <p> + * By default, only a few basic details about each person are returned, + * but the optional <code>fetch</code> parameter may be used to fetch + * additional attributes or references. + * <p> + * <code style="background-color: #eec;">[ HTTP: GET /api/v1/person/all-people ]</code> + * + * @param includeCancelled [optional] Flag to allow cancelled people to + * be included (people who are no longer members of the University). + * Defaults to {@code false}. + * @param identifier [optional] The identifier (CRSid) of the person to + * start after, or {@code null} to start from the first person. + * @param limit [optional] The maximum number of people to return. + * Defaults to 100. + * @param fetch [optional] A comma-separated list of any additional + * attributes or references to fetch. + * + * @return The requested people (in identifier order). + */ + public java.util.List<IbisPerson> allPeople(boolean includeCancelled, + String identifier, + int limit, + String fetch) + throws IbisException, IOException, JAXBException + { + String[] pathParams = { }; + Object[] queryParams = { "includeCancelled", includeCancelled, + "identifier", identifier, + "limit", limit, + "fetch", fetch }; + Object[] formParams = { }; + IbisResult result = conn.invokeMethod(Method.GET, + "api/v1/person/all-people", + pathParams, + queryParams, + formParams); + if (result.error != null) + throw new IbisException(result.error); + return result.people; + } + /** * Get the people with the specified identifiers (typically CRSids). * <p> diff --git a/src/php/ibisclient/methods/PersonMethods.php b/src/php/ibisclient/methods/PersonMethods.php index 42b7a6a91fd044a113cd7991228d38809bb7ce2b..d8fbe786e8273824708b08340ba1acb885eeffa0 100644 --- a/src/php/ibisclient/methods/PersonMethods.php +++ b/src/php/ibisclient/methods/PersonMethods.php @@ -155,6 +155,54 @@ class PersonMethods return $result->attributeSchemes; } + /** + * Return a list of all people (in batches). + * + * The results are sorted by identifier, starting with the first person + * after the person with the specified identifier. Thus, to iterate over + * all people, pass a ``null`` identifier to get the first batch of + * people, then pass the last identifier from the previous batch to get + * the next batch, and repeat until no more people are returned. + * + * By default, only a few basic details about each person are returned, + * but the optional ``fetch`` parameter may be used to fetch + * additional attributes or references. + * + * ``[ HTTP: GET /api/v1/person/all-people ]`` + * + * @param boolean $includeCancelled [optional] Flag to allow cancelled people to + * be included (people who are no longer members of the University). + * Defaults to ``false``. + * @param string $identifier [optional] The identifier (CRSid) of the person to + * start after, or ``null`` to start from the first person. + * @param int $limit [optional] The maximum number of people to return. + * Defaults to 100. + * @param string $fetch [optional] A comma-separated list of any additional + * attributes or references to fetch. + * + * @return IbisPerson[] The requested people (in identifier order). + */ + public function allPeople($includeCancelled, + $identifier=null, + $limit=null, + $fetch=null) + { + $pathParams = array(); + $queryParams = array("includeCancelled" => $includeCancelled, + "identifier" => $identifier, + "limit" => $limit, + "fetch" => $fetch); + $formParams = array(); + $result = $this->conn->invokeMethod("GET", + 'api/v1/person/all-people', + $pathParams, + $queryParams, + $formParams); + if (isset($result->error)) + throw new IbisException($result->error); + return $result->people; + } + /** * Get the people with the specified identifiers (typically CRSids). * diff --git a/src/python/ibisclient/methods.py b/src/python/ibisclient/methods.py index 5b8d1dec6b553d73905ecbcbe9770f6ccbfa92e0..fbcf3452effcaa84614b2c98a04ad203b4d3abbf 100644 --- a/src/python/ibisclient/methods.py +++ b/src/python/ibisclient/methods.py @@ -1340,6 +1340,61 @@ class PersonMethods: raise IbisException(result.error) return result.attributeSchemes + def allPeople(self, + includeCancelled, + identifier=None, + limit=None, + fetch=None): + """ + Return a list of all people (in batches). + + The results are sorted by identifier, starting with the first person + after the person with the specified identifier. Thus, to iterate over + all people, pass a :any:`None` identifier to get the first batch of + people, then pass the last identifier from the previous batch to get + the next batch, and repeat until no more people are returned. + + By default, only a few basic details about each person are returned, + but the optional `fetch` parameter may be used to fetch + additional attributes or references. + + ``[ HTTP: GET /api/v1/person/all-people ]`` + + **Parameters** + `includeCancelled` : bool + [optional] Flag to allow cancelled people to + be included (people who are no longer members of the University). + Defaults to :any:`False`. + + `identifier` : str + [optional] The identifier (CRSid) of the person to + start after, or :any:`None` to start from the first person. + + `limit` : int + [optional] The maximum number of people to return. + Defaults to 100. + + `fetch` : str + [optional] A comma-separated list of any additional + attributes or references to fetch. + + **Returns** + list of :any:`IbisPerson` + The requested people (in identifier order). + """ + path = "api/v1/person/all-people" + path_params = {} + query_params = {"includeCancelled": includeCancelled, + "identifier": identifier, + "limit": limit, + "fetch": fetch} + form_params = {} + result = self.conn.invoke_method("GET", path, path_params, + query_params, form_params) + if result.error: + raise IbisException(result.error) + return result.people + def listPeople(self, crsids, fetch=None): diff --git a/src/python3/ibisclient/methods.py b/src/python3/ibisclient/methods.py index 3b4569a1b8db09151997d9083eee233c5caa95c8..724f8ad964627fb043fa46b1a284bbfbc196709f 100644 --- a/src/python3/ibisclient/methods.py +++ b/src/python3/ibisclient/methods.py @@ -1340,6 +1340,61 @@ class PersonMethods: raise IbisException(result.error) return result.attributeSchemes + def allPeople(self, + includeCancelled, + identifier=None, + limit=None, + fetch=None): + """ + Return a list of all people (in batches). + + The results are sorted by identifier, starting with the first person + after the person with the specified identifier. Thus, to iterate over + all people, pass a :any:`None` identifier to get the first batch of + people, then pass the last identifier from the previous batch to get + the next batch, and repeat until no more people are returned. + + By default, only a few basic details about each person are returned, + but the optional `fetch` parameter may be used to fetch + additional attributes or references. + + ``[ HTTP: GET /api/v1/person/all-people ]`` + + **Parameters** + `includeCancelled` : bool + [optional] Flag to allow cancelled people to + be included (people who are no longer members of the University). + Defaults to :any:`False`. + + `identifier` : str + [optional] The identifier (CRSid) of the person to + start after, or :any:`None` to start from the first person. + + `limit` : int + [optional] The maximum number of people to return. + Defaults to 100. + + `fetch` : str + [optional] A comma-separated list of any additional + attributes or references to fetch. + + **Returns** + list of :any:`IbisPerson` + The requested people (in identifier order). + """ + path = "api/v1/person/all-people" + path_params = {} + query_params = {"includeCancelled": includeCancelled, + "identifier": identifier, + "limit": limit, + "fetch": fetch} + form_params = {} + result = self.conn.invoke_method("GET", path, path_params, + query_params, form_params) + if result.error: + raise IbisException(result.error) + return result.people + def listPeople(self, crsids, fetch=None):