from unittest.mock import call


def get_items(service,
              function,
              items='items',
              throw_reasons=None,
              retry_reasons=None,
              **kwargs):
    """Gets a single page of items from a Google service function that is paged.

  Args:
    service: A Google service object for the desired API.
    function: String, The name of a service request method to execute.
    items: String, the name of the resulting "items" field within the service
      method's response object.
    throw_reasons: A list of Google HTTP error reason strings indicating the
      errors generated by this request should be re-thrown. All other HTTP
      errors are consumed.
    retry_reasons: A list of Google HTTP error reason strings indicating which
      error should be retried, using exponential backoff techniques, when the
      error reason is encountered.
    **kwargs: Additional params to pass to the request method.

  Returns:
    The list of items in the first page of a response.
  """
    results = call(service,
                   function,
                   throw_reasons=throw_reasons,
                   retry_reasons=retry_reasons,
                   **kwargs)
    if results:
        return results.get(items, [])
    return []