• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.downloader;
17 
18 import com.google.auto.value.AutoValue;
19 import com.google.common.base.Optional;
20 
21 /** Request for checking content change. */
22 @AutoValue
23 public abstract class CheckContentChangeRequest {
24 
CheckContentChangeRequest()25   CheckContentChangeRequest() {}
26 
27   /** The target url. */
url()28   public abstract String url();
29 
30   /**
31    * The optional cached ETag stored on device, which was previously fetched from the url. When the
32    * value is {@like Optional#absent()}, it means either it is the first fetch, or the url does not
33    * respond with ETag in the last fetch.
34    */
cachedETagOptional()35   public abstract Optional<String> cachedETagOptional();
36 
newBuilder()37   public static CheckContentChangeRequest.Builder newBuilder() {
38     return new AutoValue_CheckContentChangeRequest.Builder();
39   }
40 
41   /** Builder for {@link CheckContentChangeRequest} */
42   @AutoValue.Builder
43   public abstract static class Builder {
44 
Builder()45     Builder() {}
46 
47     /** Sets the url. */
setUrl(String url)48     public abstract Builder setUrl(String url);
49 
50     /** Sets the cached ETag. */
setCachedETagOptional(Optional<String> cachedETagOptional)51     public abstract Builder setCachedETagOptional(Optional<String> cachedETagOptional);
52 
build()53     public abstract CheckContentChangeRequest build();
54   }
55 }
56