/* DO NOT EDIT */
/* This file was generated by Stone */

package com.dropbox.core.v2.sharing;

import com.dropbox.core.DbxException;

import java.util.List;

/**
 * The request builder returned by {@link
 * DbxUserSharingRequests#listFileMembersBuilder}.
 *
 * <p> Use this class to set optional request parameters and complete the
 * request. </p>
 */
public class ListFileMembersBuilder {
    private final DbxUserSharingRequests _client;
    private final ListFileMembersArg.Builder _builder;

    /**
     * Creates a new instance of this builder.
     *
     * @param _client  Dropbox namespace-specific client used to issue sharing
     *     requests.
     * @param _builder  Request argument builder.
     *
     * @return instsance of this builder
     */
    ListFileMembersBuilder(DbxUserSharingRequests _client, ListFileMembersArg.Builder _builder) {
        if (_client == null) {
            throw new NullPointerException("_client");
        }
        this._client = _client;
        if (_builder == null) {
            throw new NullPointerException("_builder");
        }
        this._builder = _builder;
    }

    /**
     * Set value for optional field.
     *
     * @param actions  The actions for which to return permissions on a member.
     *     Must not contain a {@code null} item.
     *
     * @return this builder
     *
     * @throws IllegalArgumentException  If any argument does not meet its
     *     preconditions.
     */
    public ListFileMembersBuilder withActions(List<MemberAction> actions) {
        this._builder.withActions(actions);
        return this;
    }

    /**
     * Set value for optional field.
     *
     * <p> If left unset or set to {@code null}, defaults to {@code true}. </p>
     *
     * @param includeInherited  Whether to include members who only have access
     *     from a parent shared folder. Defaults to {@code true} when set to
     *     {@code null}.
     *
     * @return this builder
     */
    public ListFileMembersBuilder withIncludeInherited(Boolean includeInherited) {
        this._builder.withIncludeInherited(includeInherited);
        return this;
    }

    /**
     * Set value for optional field.
     *
     * <p> If left unset or set to {@code null}, defaults to {@code 100L}. </p>
     *
     * @param limit  Number of members to return max per query. Defaults to 100
     *     if no limit is specified. Must be greater than or equal to 1 and be
     *     less than or equal to 300. Defaults to {@code 100L} when set to
     *     {@code null}.
     *
     * @return this builder
     *
     * @throws IllegalArgumentException  If any argument does not meet its
     *     preconditions.
     */
    public ListFileMembersBuilder withLimit(Long limit) {
        this._builder.withLimit(limit);
        return this;
    }

    /**
     * Issues the request.
     */
    public SharedFileMembers start() throws ListFileMembersErrorException, DbxException {
        ListFileMembersArg arg_ = this._builder.build();
        return _client.listFileMembers(arg_);
    }
}
