slack-ruby/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/admin_teams.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
  module Web
    module Api
      module Endpoints
        module AdminTeams
          #
          # Create an Enterprise team.
          #
          # @option options [string] :team_domain
          #   Team domain (for example, slacksoftballteam). Domains are limited to 21 characters.
          # @option options [string] :team_name
          #   Team name (for example, Slack Softball Team).
          # @option options [string] :team_description
          #   Description for the team.
          # @option options [string] :team_discoverability
          #   Who can join the team. A team's discoverability can be open, closed, invite_only, or unlisted.
          # @see https://api.slack.com/methods/admin.teams.create
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams/admin.teams.create.json
          def admin_teams_create(options = {})
            raise ArgumentError, 'Required arguments :team_domain missing' if options[:team_domain].nil?
            raise ArgumentError, 'Required arguments :team_name missing' if options[:team_name].nil?
            post('admin.teams.create', options)
          end

          #
          # List all teams on an Enterprise organization
          #
          # @option options [string] :cursor
          #   Set cursor to next_cursor returned by the previous call to list items in the next page.
          # @option options [integer] :limit
          #   The maximum number of items to return. Must be a positive integer no larger than 1000.
          # @see https://api.slack.com/methods/admin.teams.list
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams/admin.teams.list.json
          def admin_teams_list(options = {})
            if block_given?
              Pagination::Cursor.new(self, :admin_teams_list, options).each do |page|
                yield page
              end
            else
              post('admin.teams.list', options)
            end
          end
        end
      end
    end
  end
end