All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.toloka.client.v1.attachment.AttachmentSearchRequest Maven / Gradle / Ivy

Go to download

Toloka has a powerful open API, it allows you to integrate an on-demand workforce directly into your processes, and to build scalable and fully automated human-in-the-loop ML pipelines.

There is a newer version: 0.0.7
Show newest version
/*
 * Copyright 2021 YANDEX LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ai.toloka.client.v1.attachment;

import java.util.Date;
import java.util.Map;

import ai.toloka.client.v1.SearchRequest;

public class AttachmentSearchRequest extends SearchRequest {

    static final String OWNER_ID_PARAMETER = "owner_id";
    static final String OWNER_COMPANY_ID_PARAMETER = "owner_company_id";
    public static final String NAME_PARAMETER = "name";
    public static final String ATTACHMENT_TYPE_PARAMETER = "type";
    public static final String USER_ID_PARAMETER = "user_id";
    public static final String ASSIGNMENT_ID_PARAMETER = "assignment_id";
    public static final String POOL_ID_PARAMETER = "pool_id";

    public static final String ID_PARAMETER = "id";
    public static final String CREATED_PARAMETER = "created";

    private AttachmentSearchRequest(Map filterParameters, Map rangeParameters,
                                    String sortParameter, Integer limit) {

        super(filterParameters, rangeParameters, sortParameter, limit);
    }

    public static AttachmentBuilder make() {
        return new AttachmentBuilder(
                new AttachmentFilterBuilder(), new AttachmentRangeBuilder(), new AttachmentSortBuilder());
    }

    public static class AttachmentBuilder extends Builder<
            AttachmentSearchRequest,
            AttachmentBuilder,
            AttachmentFilterBuilder,
            AttachmentRangeBuilder,
            AttachmentSortBuilder> {

        private AttachmentBuilder(AttachmentFilterBuilder filterBuilder, AttachmentRangeBuilder rangeBuilder,
                                  AttachmentSortBuilder sortBuilder) {

            super(filterBuilder, rangeBuilder, sortBuilder);
        }

        @Override public AttachmentSearchRequest done() {
            return new AttachmentSearchRequest(filterBuilder.getFilterParameters(), rangeBuilder.getRangeParameters(),
                    sortBuilder.getSortParameter(), getLimit());
        }
    }

    public static class AttachmentFilterBuilder
            extends FilterBuilder {

        public AttachmentFilterBuilder byOwnerId(String ownerId) {
            return by(AttachmentFilterParam.ownerId, ownerId);
        }

        public AttachmentFilterBuilder byOwnerCompanyId(String ownerCompanyId) {
            return by(AttachmentFilterParam.ownerCompanyId, ownerCompanyId);
        }

        public AttachmentFilterBuilder byName(String name) {
            return by(AttachmentFilterParam.name, name);
        }

        public AttachmentFilterBuilder byAttachmentType(AttachmentType attachmentType) {
            return by(AttachmentFilterParam.attachmentType, attachmentType);
        }

        public AttachmentFilterBuilder byUserId(String userId) {
            return by(AttachmentFilterParam.userId, userId);
        }

        public AttachmentFilterBuilder byAssignmentId(String assignmentId) {
            return by(AttachmentFilterParam.assignmentId, assignmentId);
        }

        public AttachmentFilterBuilder byPoolId(String poolId) {
            return by(AttachmentFilterParam.poolId, poolId);
        }
    }

    public static class AttachmentRangeBuilder
            extends RangeBuilder {

        public RangeItemBuilder byId(String id) {
            return by(AttachmentRangeParam.id, id);
        }

        public RangeItemBuilder byCreated(Date created) {
            return by(AttachmentRangeParam.created, created);
        }
    }

    public static class AttachmentSortBuilder
            extends SortBuilder {

        public SortItem byId() {
            return by(AttachmentSortParam.id);
        }

        public SortItem byCreated() {
            return by(AttachmentSortParam.created);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy