1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.libraries.mobiledatadownload; 17 18 import android.accounts.Account; 19 import com.google.auto.value.AutoValue; 20 import com.google.common.base.Optional; 21 import javax.annotation.concurrent.Immutable; 22 23 /** Request to remove file group from MDD. */ 24 @AutoValue 25 @Immutable 26 public abstract class RemoveFileGroupRequest { RemoveFileGroupRequest()27 RemoveFileGroupRequest() {} 28 groupName()29 public abstract String groupName(); 30 accountOptional()31 public abstract Optional<Account> accountOptional(); 32 variantIdOptional()33 public abstract Optional<String> variantIdOptional(); 34 pendingOnly()35 public abstract boolean pendingOnly(); 36 newBuilder()37 public static Builder newBuilder() { 38 return new AutoValue_RemoveFileGroupRequest.Builder().setPendingOnly(false); 39 } 40 41 /** Builder for {@link RemoveFileGroupRequest}. */ 42 @AutoValue.Builder 43 public abstract static class Builder { Builder()44 Builder() {} 45 46 /** Sets the name of the file group, which is required. */ setGroupName(String groupName)47 public abstract Builder setGroupName(String groupName); 48 49 /** Sets the account that is associated to the file group, which is optional. */ setAccountOptional(Optional<Account> accountOptional)50 public abstract Builder setAccountOptional(Optional<Account> accountOptional); 51 52 /** 53 * Sets the variant id that is associated to the file group. 54 * 55 * <p>This parameter is only required to remove a group that was added to MDD with a variantId 56 * specified (see {@link AddFileGroupRequest.Builder#setVariantIdOptional}). 57 * 58 * <p>If a variantId was specified when adding the group to MDD and is not included here, the 59 * request will result in a no-op. 60 * 61 * <p>Similarly, if a variantId was <em>not</em> specified when adding the group to MDD and 62 * <em>is</em> included here, the request will also result in a no-op. 63 */ setVariantIdOptional(Optional<String> variantIdOptional)64 public abstract Builder setVariantIdOptional(Optional<String> variantIdOptional); 65 66 /** 67 * When true, only remove the pending version of the file group, leaving the active downloaded 68 * version untouched. 69 */ setPendingOnly(boolean pendingOnly)70 public abstract Builder setPendingOnly(boolean pendingOnly); 71 build()72 public abstract RemoveFileGroupRequest build(); 73 } 74 } 75