Edits history of script submission #298 for ' List Users (slack)'

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts"
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { SlackAPI } from "https://deno.land/x/[email protected]/mod.ts";
    
    /**
     * @param cursor Paginate the list of users by setting the cursor parameter 
     * to a `next_cursor` attribute returned by a previous request's 
     * `response_metadata`. Default value fetches the first "page" of the users. 
     * Used in conjunction with `limit`.
     * 
     * @param limit The maximum number of users to return. Fewer than the 
     * requested number of users may be returned, even if the end of the result 
     * list hasn't been reached. 
     * Used in conjunction with `cursor`.
     */
    export async function main(
      auth: Resource<'slack'>,
      cursor?: string,
      limit?: number
    ) {
      const client = SlackAPI(auth.token)
      const params = removeObjectEmptyFields({ cursor, limit })
      return await client.users.list(params)
    }
    

    Submitted by user471 1212 days ago