1 /* 2 * Copyright (C) 2023 The Android Open Source Project 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 17 package com.android.adservices.service.signals.updateprocessors; 18 19 import android.net.Uri; 20 21 import androidx.annotation.NonNull; 22 import androidx.annotation.Nullable; 23 24 import com.google.auto.value.AutoValue; 25 26 /** Event corresponding to buyer updating their encoder endpoint during signals fetch */ 27 @AutoValue 28 public abstract class UpdateEncoderEvent { 29 30 /** 31 * @return an {@link UpdateType} which is part of finite enums of recognized events 32 */ 33 @NonNull getUpdateType()34 public abstract UpdateType getUpdateType(); 35 36 /** 37 * @return the endpoint updated in the event 38 */ 39 @Nullable getEncoderEndpointUri()40 public abstract Uri getEncoderEndpointUri(); 41 42 /** 43 * @return a builder to build {@link UpdateEncoderEvent} 44 */ builder()45 public static Builder builder() { 46 return new AutoValue_UpdateEncoderEvent.Builder(); 47 } 48 49 /** A builder to build {@link UpdateEncoderEvent} */ 50 @AutoValue.Builder 51 public abstract static class Builder { 52 53 /** see {@link #getUpdateType()} for more details */ setUpdateType(@onNull UpdateType action)54 public abstract Builder setUpdateType(@NonNull UpdateType action); 55 56 /** see {@link #getEncoderEndpointUri()} for more details */ setEncoderEndpointUri(@ullable Uri endpointUri)57 public abstract Builder setEncoderEndpointUri(@Nullable Uri endpointUri); 58 59 /** 60 * @return an instance of {@link UpdateEncoderEvent} 61 * <p>Throws NPE in case the object is attempted to be built with null fields where not 62 * expected 63 */ build()64 public abstract UpdateEncoderEvent build(); 65 } 66 67 public enum UpdateType { 68 REGISTER 69 } 70 } 71