Net-Async-Slack

 view release on metacpan or  search on metacpan

lib/Net/Async/Slack/Commands.pm  view on Meta::CPAN

Resolves to a structure representing the response.

=cut

async sub admin_conversations_disconnect_shared {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_disconnect_shared',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(channel_id leaving_team_ids)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_ekm_list_original_connected_channel_info

List all disconnected channels—i.e., channels that were once connected to other workspaces and then disconnected—and the corresponding original channel IDs for key revocation with EKM.

L<API method documentation|https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo>

Takes the following named parameters:

=over 4

=item * C<channel_ids> - A comma-separated list of channels to filter to. (string, optional)

=item * C<team_ids> - A comma-separated list of the workspaces to which the channels you would like returned belong. (string, optional)

=item * C<limit> - The maximum number of items to return. Must be between 1 - 1000 both inclusive. (integer, optional)

=item * C<cursor> - Set `cursor` to `next_cursor` returned by the previous call to list items in the next page. (string, optional)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_ekm_list_original_connected_channel_info {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_ekm_list_original_connected_channel_info',
        %args{grep { exists $args{$_} } qw(channel_ids team_ids limit cursor)}
    );
    my ($res) = await $self->http_get(
        $uri,
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_get_conversation_prefs

Get conversation preferences for a public or private channel.

L<API method documentation|https://api.slack.com/methods/admin.conversations.getConversationPrefs>

Takes the following named parameters:

=over 4

=item * C<channel_id> - The channel to get preferences for. (string, required)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_get_conversation_prefs {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_get_conversation_prefs',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(channel_id)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_get_teams

Get all the workspaces a given public or private channel is connected to within this Enterprise org.

L<API method documentation|https://api.slack.com/methods/admin.conversations.getTeams>

Takes the following named parameters:

=over 4

=item * C<channel_id> - The channel to determine connected workspaces within the organization for. (string, required)

=item * C<cursor> - Set `cursor` to `next_cursor` returned by the previous call to list items in the next page (string, optional)

=item * C<limit> - The maximum number of items to return. Must be between 1 - 1000 both inclusive. (integer, optional)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_get_teams {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_get_teams',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(channel_id cursor limit)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_invite

Invite a user to a public or private channel.

L<API method documentation|https://api.slack.com/methods/admin.conversations.invite>

lib/Net/Async/Slack/Commands.pm  view on Meta::CPAN

    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(team_id group_id channel_id)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_search

Search for public or private channels in an Enterprise organization.

L<API method documentation|https://api.slack.com/methods/admin.conversations.search>

Takes the following named parameters:

=over 4

=item * C<team_ids> - Comma separated string of team IDs, signifying the workspaces to search through. (string, optional)

=item * C<query> - Name of the the channel to query by. (string, optional)

=item * C<limit> - Maximum number of items to be returned. Must be between 1 - 20 both inclusive. Default is 10. (integer, optional)

=item * C<cursor> - Set `cursor` to `next_cursor` returned by the previous call to list items in the next page. (string, optional)

=item * C<search_channel_types> - The type of channel to include or exclude in the search. For example `private` will search private channels, while `private_exclude` will exclude them. For a full list of types, check the [Types section](#types). (st...

=item * C<sort> - Possible values are `relevant` (search ranking based on what we think is closest), `name` (alphabetical), `member_count` (number of users in the channel), and `created` (date channel was created). You can optionally pair this with t...

=item * C<sort_dir> - Sort direction. Possible values are `asc` for ascending order like (1, 2, 3) or (a, b, c), and `desc` for descending order like (3, 2, 1) or (c, b, a) (string, optional)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_search {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_search',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(team_ids query limit cursor search_channel_types sort sort_dir)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    return $res;
}


=head2 admin_conversations_set_conversation_prefs

Set the posting permissions for a public or private channel.

L<API method documentation|https://api.slack.com/methods/admin.conversations.setConversationPrefs>

Takes the following named parameters:

=over 4

=item * C<channel_id> - The channel to set the prefs for (string, required)

=item * C<prefs> - The prefs for this channel in a stringified JSON format. (string, required)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_set_conversation_prefs {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_set_conversation_prefs',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(channel_id prefs)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_set_teams

Set the workspaces in an Enterprise grid org that connect to a public or private channel.

L<API method documentation|https://api.slack.com/methods/admin.conversations.setTeams>

Takes the following named parameters:

=over 4

=item * C<channel_id> - The encoded `channel_id` to add or remove to workspaces. (string, required)

=item * C<team_id> - The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel. (string, optional)

=item * C<target_team_ids> - A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide. (string, optional)

=item * C<org_channel> - True if channel has to be converted to an org channel (boolean, optional)

=back

Resolves to a structure representing the response.

=cut

async sub admin_conversations_set_teams {
    my ($self, %args) = @_;
    my $uri = $self->endpoint(
        'admin_conversations_set_teams',
    );
    my $content = encode_json_utf8({
        %args{grep { exists $args{$_} } qw(channel_id team_id target_team_ids org_channel)}
    });
    my ($res) = await $self->http_post(
        $uri,
        $content,
        content_type => 'application/json; charset=utf-8',
    );
    die $res unless $res->{ok};
    return $res;
}


=head2 admin_conversations_unarchive

Unarchive a public or private channel.

L<API method documentation|https://api.slack.com/methods/admin.conversations.unarchive>

Takes the following named parameters:



( run in 2.414 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )