Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Allows the *Lookup methods to accept arrays of identifiers or screen names #45

Commits on Aug 17, 2017

  1. Allows the *Lookup methods to accept arrays of identifiers or scree…

    …n names
    
    Each of the `followers/lookup` and `users/lookup` endpoints allow either
    a `user_id` or `screen_name` parameter, and either of these may be a
    single user identifier, or comma-separated list of them.
    
    To enable this, I created a new method, `createUserListParameter()`,
    which does the following:
    
    - If the `$ids` argument is not an array, it proxies to
      `createUserParameter()`.
    - If the `$ids` argument is more than 100 items, it raises an exception
      (per the Twitter API docs, no more than 100 lookups can be performed in
      a single request).
    - If the array is a mixture of integer identifiers and string screen
      names, it raises an exception (we can only send one type of lookup per
      request).
    - If the array is of screen names, it validates each.
    
    I also updated `createUserParameter()` to raise an exception if the
    `$id` is neither an integer nor a string, which makes it more robust. It
    also does a lookup between `validInteger()` and `validateScreenName()`
    for a string  value, raising an exception if not, as the latter method
    only accepts strings.
    
    Finally, I updated `validInteger` to return 0 if a non-integer,
    non-string value is provided.
    weierophinney committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    8a38229 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a451aaf View commit details
    Browse the repository at this point in the history