|
| 1 | +/* |
| 2 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
| 3 | + * in compliance with the License. You may obtain a copy of the License at |
| 4 | + * |
| 5 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | + * |
| 7 | + * Unless required by applicable law or agreed to in writing, software distributed under the License |
| 8 | + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 9 | + * or implied. See the License for the specific language governing permissions and limitations under |
| 10 | + * the License. |
| 11 | + */ |
| 12 | +/* |
| 13 | + * This code was generated by https://github.com/googleapis/google-api-java-client-services/ |
| 14 | + * Modify at your own risk. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.api.services.workspaceevents.v1; |
| 18 | + |
| 19 | +/** |
| 20 | + * Service definition for WorkspaceEvents (v1). |
| 21 | + * |
| 22 | + * <p> |
| 23 | + * The Google Workspace Events API lets you subscribe to events and manage change notifications across Google Workspace applications. |
| 24 | + * </p> |
| 25 | + * |
| 26 | + * <p> |
| 27 | + * For more information about this service, see the |
| 28 | + * <a href="https://developers.google.com/workspace/events" target="_blank">API Documentation</a> |
| 29 | + * </p> |
| 30 | + * |
| 31 | + * <p> |
| 32 | + * This service uses {@link WorkspaceEventsRequestInitializer} to initialize global parameters via its |
| 33 | + * {@link Builder}. |
| 34 | + * </p> |
| 35 | + * |
| 36 | + * @since 1.3 |
| 37 | + * @author Google, Inc. |
| 38 | + */ |
| 39 | +@SuppressWarnings("javadoc") |
| 40 | +public class WorkspaceEvents extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient { |
| 41 | + |
| 42 | + // Note: Leave this static initializer at the top of the file. |
| 43 | + static { |
| 44 | + com.google.api.client.util.Preconditions.checkState( |
| 45 | + (com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 && |
| 46 | + (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 32 || |
| 47 | + (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION == 31 && |
| 48 | + com.google.api.client.googleapis.GoogleUtils.BUGFIX_VERSION >= 1))) || |
| 49 | + com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION >= 2, |
| 50 | + "You are currently running with version %s of google-api-client. " + |
| 51 | + "You need at least version 1.31.1 of google-api-client to run version " + |
| 52 | + "2.0.0 of the Google Workspace Events API library.", com.google.api.client.googleapis.GoogleUtils.VERSION); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * The default encoded root URL of the service. This is determined when the library is generated |
| 57 | + * and normally should not be changed. |
| 58 | + * |
| 59 | + * @since 1.7 |
| 60 | + */ |
| 61 | + public static final String DEFAULT_ROOT_URL = "https://workspaceevents.googleapis.com/"; |
| 62 | + |
| 63 | + /** |
| 64 | + * The default encoded mTLS root URL of the service. This is determined when the library is generated |
| 65 | + * and normally should not be changed. |
| 66 | + * |
| 67 | + * @since 1.31 |
| 68 | + */ |
| 69 | + public static final String DEFAULT_MTLS_ROOT_URL = "https://workspaceevents.mtls.googleapis.com/"; |
| 70 | + |
| 71 | + /** |
| 72 | + * The default encoded service path of the service. This is determined when the library is |
| 73 | + * generated and normally should not be changed. |
| 74 | + * |
| 75 | + * @since 1.7 |
| 76 | + */ |
| 77 | + public static final String DEFAULT_SERVICE_PATH = ""; |
| 78 | + |
| 79 | + /** |
| 80 | + * The default encoded batch path of the service. This is determined when the library is |
| 81 | + * generated and normally should not be changed. |
| 82 | + * |
| 83 | + * @since 1.23 |
| 84 | + */ |
| 85 | + public static final String DEFAULT_BATCH_PATH = "batch"; |
| 86 | + |
| 87 | + /** |
| 88 | + * The default encoded base URL of the service. This is determined when the library is generated |
| 89 | + * and normally should not be changed. |
| 90 | + */ |
| 91 | + public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH; |
| 92 | + |
| 93 | + /** |
| 94 | + * Constructor. |
| 95 | + * |
| 96 | + * <p> |
| 97 | + * Use {@link Builder} if you need to specify any of the optional parameters. |
| 98 | + * </p> |
| 99 | + * |
| 100 | + * @param transport HTTP transport, which should normally be: |
| 101 | + * <ul> |
| 102 | + * <li>Google App Engine: |
| 103 | + * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> |
| 104 | + * <li>Android: {@code newCompatibleTransport} from |
| 105 | + * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> |
| 106 | + * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} |
| 107 | + * </li> |
| 108 | + * </ul> |
| 109 | + * @param jsonFactory JSON factory, which may be: |
| 110 | + * <ul> |
| 111 | + * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> |
| 112 | + * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> |
| 113 | + * <li>Android Honeycomb or higher: |
| 114 | + * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> |
| 115 | + * </ul> |
| 116 | + * @param httpRequestInitializer HTTP request initializer or {@code null} for none |
| 117 | + * @since 1.7 |
| 118 | + */ |
| 119 | + public WorkspaceEvents(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory, |
| 120 | + com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { |
| 121 | + this(new Builder(transport, jsonFactory, httpRequestInitializer)); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * @param builder builder |
| 126 | + */ |
| 127 | + WorkspaceEvents(Builder builder) { |
| 128 | + super(builder); |
| 129 | + } |
| 130 | + |
| 131 | + @Override |
| 132 | + protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException { |
| 133 | + super.initialize(httpClientRequest); |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * Builder for {@link WorkspaceEvents}. |
| 138 | + * |
| 139 | + * <p> |
| 140 | + * Implementation is not thread-safe. |
| 141 | + * </p> |
| 142 | + * |
| 143 | + * @since 1.3.0 |
| 144 | + */ |
| 145 | + public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder { |
| 146 | + |
| 147 | + private static String chooseEndpoint(com.google.api.client.http.HttpTransport transport) { |
| 148 | + // If the GOOGLE_API_USE_MTLS_ENDPOINT environment variable value is "always", use mTLS endpoint. |
| 149 | + // If the env variable is "auto", use mTLS endpoint if and only if the transport is mTLS. |
| 150 | + // Use the regular endpoint for all other cases. |
| 151 | + String useMtlsEndpoint = System.getenv("GOOGLE_API_USE_MTLS_ENDPOINT"); |
| 152 | + useMtlsEndpoint = useMtlsEndpoint == null ? "auto" : useMtlsEndpoint; |
| 153 | + if ("always".equals(useMtlsEndpoint) || ("auto".equals(useMtlsEndpoint) && transport != null && transport.isMtls())) { |
| 154 | + return DEFAULT_MTLS_ROOT_URL; |
| 155 | + } |
| 156 | + return DEFAULT_ROOT_URL; |
| 157 | + } |
| 158 | + |
| 159 | + /** |
| 160 | + * Returns an instance of a new builder. |
| 161 | + * |
| 162 | + * @param transport HTTP transport, which should normally be: |
| 163 | + * <ul> |
| 164 | + * <li>Google App Engine: |
| 165 | + * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> |
| 166 | + * <li>Android: {@code newCompatibleTransport} from |
| 167 | + * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> |
| 168 | + * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} |
| 169 | + * </li> |
| 170 | + * </ul> |
| 171 | + * @param jsonFactory JSON factory, which may be: |
| 172 | + * <ul> |
| 173 | + * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> |
| 174 | + * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> |
| 175 | + * <li>Android Honeycomb or higher: |
| 176 | + * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> |
| 177 | + * </ul> |
| 178 | + * @param httpRequestInitializer HTTP request initializer or {@code null} for none |
| 179 | + * @since 1.7 |
| 180 | + */ |
| 181 | + public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory, |
| 182 | + com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { |
| 183 | + super( |
| 184 | + transport, |
| 185 | + jsonFactory, |
| 186 | + Builder.chooseEndpoint(transport), |
| 187 | + DEFAULT_SERVICE_PATH, |
| 188 | + httpRequestInitializer, |
| 189 | + false); |
| 190 | + setBatchPath(DEFAULT_BATCH_PATH); |
| 191 | + } |
| 192 | + |
| 193 | + /** Builds a new instance of {@link WorkspaceEvents}. */ |
| 194 | + @Override |
| 195 | + public WorkspaceEvents build() { |
| 196 | + return new WorkspaceEvents(this); |
| 197 | + } |
| 198 | + |
| 199 | + @Override |
| 200 | + public Builder setRootUrl(String rootUrl) { |
| 201 | + return (Builder) super.setRootUrl(rootUrl); |
| 202 | + } |
| 203 | + |
| 204 | + @Override |
| 205 | + public Builder setServicePath(String servicePath) { |
| 206 | + return (Builder) super.setServicePath(servicePath); |
| 207 | + } |
| 208 | + |
| 209 | + @Override |
| 210 | + public Builder setBatchPath(String batchPath) { |
| 211 | + return (Builder) super.setBatchPath(batchPath); |
| 212 | + } |
| 213 | + |
| 214 | + @Override |
| 215 | + public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { |
| 216 | + return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); |
| 217 | + } |
| 218 | + |
| 219 | + @Override |
| 220 | + public Builder setApplicationName(String applicationName) { |
| 221 | + return (Builder) super.setApplicationName(applicationName); |
| 222 | + } |
| 223 | + |
| 224 | + @Override |
| 225 | + public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { |
| 226 | + return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); |
| 227 | + } |
| 228 | + |
| 229 | + @Override |
| 230 | + public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { |
| 231 | + return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); |
| 232 | + } |
| 233 | + |
| 234 | + @Override |
| 235 | + public Builder setSuppressAllChecks(boolean suppressAllChecks) { |
| 236 | + return (Builder) super.setSuppressAllChecks(suppressAllChecks); |
| 237 | + } |
| 238 | + |
| 239 | + /** |
| 240 | + * Set the {@link WorkspaceEventsRequestInitializer}. |
| 241 | + * |
| 242 | + * @since 1.12 |
| 243 | + */ |
| 244 | + public Builder setWorkspaceEventsRequestInitializer( |
| 245 | + WorkspaceEventsRequestInitializer workspaceeventsRequestInitializer) { |
| 246 | + return (Builder) super.setGoogleClientRequestInitializer(workspaceeventsRequestInitializer); |
| 247 | + } |
| 248 | + |
| 249 | + @Override |
| 250 | + public Builder setGoogleClientRequestInitializer( |
| 251 | + com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) { |
| 252 | + return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); |
| 253 | + } |
| 254 | + } |
| 255 | +} |
0 commit comments