diff options
author | Jonathan Taylor <jon@stackhaus.com> | 2021-01-18 15:17:44 +0000 |
---|---|---|
committer | Aran Clary Deltac <bluefeet@gmail.com> | 2023-06-07 13:38:22 -0700 |
commit | 4a7f57544a49a28fcd400a404c9f8745d47bc343 (patch) | |
tree | 2b9612299dab18cfbd81d0199e9768c2395af1ab | |
parent | 749937ee984e88303f5b95383d7ca70e55a2bff1 (diff) |
Add two new method share_group_with_group and unshare_group_with_group, based on share_project_with_group
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | author/sections/groups.yml | 2 | ||||
-rw-r--r-- | lib/GitLab/API/v4.pm | 46 |
3 files changed, 70 insertions, 0 deletions
@@ -1463,6 +1463,28 @@ See [https://docs.gitlab.com/ce/api/groups.html](https://docs.gitlab.com/ce/api/ Sends a `DELETE` request to `groups/:group_id/ldap_group_links/:provider/:cn`. +- share\_group\_with\_group + + ``` + $api->share_group_with_group( + $group_id, + \%params, + ); + ``` + + Sends a `POST` request to `groups/:group_id/share`. + +- unshare\_group\_with\_group + + ``` + $api->unshare_group_with_group( + $group_id, + $shared_with_group_id, + ); + ``` + + Sends a `DELETE` request to `groups/:group_id/share/:shared_with_group_id`. + ## Group access requests See [https://docs.gitlab.com/ce/api/access\_requests.html](https://docs.gitlab.com/ce/api/access_requests.html). diff --git a/author/sections/groups.yml b/author/sections/groups.yml index 55b126c..5fdee86 100644 --- a/author/sections/groups.yml +++ b/author/sections/groups.yml @@ -11,3 +11,5 @@ - create_ldap_group_link: POST groups/:group_id/ldap_group_links? - delete_ldap_group_link: DELETE groups/:group_id/ldap_group_links/:cn - delete_ldap_provider_group_link: DELETE groups/:group_id/ldap_group_links/:provider/:cn +- share_group_with_group: POST groups/:group_id/share? +- unshare_group_with_group: DELETE groups/:group_id/share/:shared_with_group_id
\ No newline at end of file diff --git a/lib/GitLab/API/v4.pm b/lib/GitLab/API/v4.pm index fa4bcd5..954c835 100644 --- a/lib/GitLab/API/v4.pm +++ b/lib/GitLab/API/v4.pm @@ -2898,6 +2898,52 @@ sub delete_ldap_provider_group_link { return; } +=item share_group_with_group + + $api->share_group_with_group( + $group_id, + \%params, + ); + +Sends a C<POST> request to C<groups/:group_id/share>. + +=cut + +sub share_group_with_group { + my $self = shift; + croak 'share_group_with_group must be called with 1 to 2 arguments' if @_ < 1 or @_ > 2; + croak 'The #1 argument ($group_id) to share_group_with_group must be a scalar' if ref($_[0]) or (!defined $_[0]); + croak 'The last argument (\%params) to share_group_with_group must be a hash ref' if defined($_[1]) and ref($_[1]) ne 'HASH'; + my $params = (@_ == 2) ? pop() : undef; + my $options = {}; + $options->{decode} = 0; + $options->{content} = $params if defined $params; + $self->_call_rest_client( 'POST', 'groups/:group_id/share', [@_], $options ); + return; +} + +=item unshare_group_with_group + + $api->unshare_group_with_group( + $group_id, + $shared_with_group_id, + ); + +Sends a C<DELETE> request to C<groups/:group_id/share/:shared_with_group_id>. + +=cut + +sub unshare_group_with_group { + my $self = shift; + croak 'unshare_group_with_group must be called with 2 arguments' if @_ != 2; + croak 'The #1 argument ($group_id) to unshare_group_with_group must be a scalar' if ref($_[0]) or (!defined $_[0]); + croak 'The #2 argument ($shared_with_group_id) to unshare_group_with_group must be a scalar' if ref($_[1]) or (!defined $_[1]); + my $options = {}; + $options->{decode} = 0; + $self->_call_rest_client( 'DELETE', 'groups/:group_id/share/:shared_with_group_id', [@_], $options ); + return; +} + =back =head2 Group access requests |