Box.V2.Managers.BoxCollaborationsManager.AddCollaborationAsync C# (CSharp) Метод

AddCollaborationAsync() публичный Метод

Used to add a collaboration for a single user or a single group to a folder. Either an email address, a user ID, or a group id can be used to create the collaboration. If the collaboration is being created with a group, access to this endpoint is granted based on the group's invitability_level.
public AddCollaborationAsync ( BoxCollaborationRequest collaborationRequest, List fields = null, bool notify = null ) : Task
collaborationRequest Box.V2.Models.BoxCollaborationRequest BoxCollaborationRequest object.
fields List Attribute(s) to include in the response.
notify bool Determines if the user, (or all the users in the group) should receive email notification of the collaboration.
Результат Task
        public async Task<BoxCollaboration> AddCollaborationAsync(BoxCollaborationRequest collaborationRequest, List<string> fields = null, bool? notify = null)
        {
            collaborationRequest.ThrowIfNull("collaborationRequest")
                .Item.ThrowIfNull("collaborationRequest.Item")
                .Id.ThrowIfNullOrWhiteSpace("collaborationRequest.Item.Id");
            collaborationRequest.AccessibleBy.ThrowIfNull("collaborationRequest.AccessibleBy");
            collaborationRequest.Role.ThrowIfNullOrWhiteSpace("Role");

            BoxRequest request = new BoxRequest(_config.CollaborationsEndpointUri)
                .Method(RequestMethod.Post)
                .Param(ParamFields, fields)
                .Payload(_converter.Serialize(collaborationRequest));

            if (notify.HasValue)
            {
                var value = notify.Value ? "true" : "false";
                request.Param("notify", value);
            }

            IBoxResponse<BoxCollaboration> response = await ToResponseAsync<BoxCollaboration>(request).ConfigureAwait(false);

            return response.ResponseObject;
        }