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 com.google.mobiledatadownload.DownloadConfigProto.DataFileGroup; 22 import javax.annotation.concurrent.Immutable; 23 24 /** Request to add file group in MDD. */ 25 @AutoValue 26 @Immutable 27 public abstract class AddFileGroupRequest { AddFileGroupRequest()28 AddFileGroupRequest() {} 29 dataFileGroup()30 public abstract DataFileGroup dataFileGroup(); 31 accountOptional()32 public abstract Optional<Account> accountOptional(); 33 variantIdOptional()34 public abstract Optional<String> variantIdOptional(); 35 newBuilder()36 public static Builder newBuilder() { 37 return new AutoValue_AddFileGroupRequest.Builder(); 38 } 39 40 /** Builder for {@link AddFileGroupRequest}. */ 41 @AutoValue.Builder 42 public abstract static class Builder { Builder()43 Builder() {} 44 45 /** Sets the data file group, which is required. */ setDataFileGroup(DataFileGroup dataFileGroup)46 public abstract Builder setDataFileGroup(DataFileGroup dataFileGroup); 47 48 /** 49 * Sets the account associated with the group, which is optional. 50 * 51 * <p>NOTE: When this option is set, it will also be required when retrieving file groups in 52 * {@link GetFileGroupRequest}. 53 */ setAccountOptional(Optional<Account> accountOptional)54 public abstract Builder setAccountOptional(Optional<Account> accountOptional); 55 56 /** 57 * Sets the variant id associated with the group, which is optional. 58 * 59 * <p>NOTE: When this option is set, it will also be required when retrieving file groups in 60 * {@link GetFileGroupRequest}. 61 */ setVariantIdOptional(Optional<String> variantIdOptional)62 public abstract Builder setVariantIdOptional(Optional<String> variantIdOptional); 63 build()64 public abstract AddFileGroupRequest build(); 65 } 66 } 67