public class GmailFilterService extends AppsForYourDomainService
AppsForYourDomainService
abstraction to define a service that is preconfigured for access to the
the Google Apps Gmail Settings API.GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
Service.ClientInputProperties, Service.ClientOutputProperties, Service.ClientStreamProperties, Service.GDataRequest, Service.GDataRequestFactory, Service.Versions
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPS_APIS_DOMAIN
Domain for sending API requests.
|
static java.lang.String |
BATCH_URL_SUFFIX
URL suffix for the Gmail filter batch feed.
|
static java.lang.String |
URL_PREFIX
URL prefix for accessing Gmail setting feeds.
|
static java.lang.String |
URL_SUFFIX
URL suffix for the single Gmail filter feed.
|
APPS_SERVICE, DOMAIN_NAME, HTTPS_PROTOCOL
connectTimeout, extProfile, metadataRegistry, requestFactory
Constructor and Description |
---|
GmailFilterService(java.lang.String applicationName)
Constructs a GmailFilterService instance for an application with
the name
applicationName . |
Modifier and Type | Method and Description |
---|---|
GenericFeed |
batch(java.lang.String domain,
GenericFeed feed)
Inserts one or more Gmail filter entries in a single batch operation.
|
GenericEntry |
insert(java.lang.String domain,
GenericEntry entry)
Inserts one Gmail filter entry.
|
delete, getAllPages, getEntry, getEntry, getFeed, getFeed, insert, query, update
addCookie, batch, createRequest, createRequest, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getFeed, getFeed, getFeed, handleRedirectException, handlesCookies, handleSessionExpiredException, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
classOf, createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, endVersionScope, getAltRegistry, getContentType, getDefaultAltRegistry, getExtensionProfile, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getStrictValidation, getVersion, initServiceVersion, introspect, parseResponseData, parseResponseData, patch, patch, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setStrictValidation, setTimeouts, startVersionScope, update, useSsl, writeRequestData, writeRequestData
public static final java.lang.String APPS_APIS_DOMAIN
public static final java.lang.String URL_PREFIX
public static final java.lang.String URL_SUFFIX
public static final java.lang.String BATCH_URL_SUFFIX
public GmailFilterService(java.lang.String applicationName)
applicationName
.applicationName
- the name of the client application accessing the
service. Application names should preferably have
the format [company-id]-[app-name]-[app-version].
The name will be used by the Google servers to
monitor the source of authentication.public GenericEntry insert(java.lang.String domain, GenericEntry entry) throws java.io.IOException, java.net.MalformedURLException, ServiceException
domain
- the domain into which the filter is being created.entry
- an GenericEntry
object containing all the properties
of a Gmail filter.java.io.IOException
- if an error occurs while communicating with the GData
service.java.net.MalformedURLException
- if the batch feed URL cannot be constructed.ServiceException
- if the insert request failed due to system error.public GenericFeed batch(java.lang.String domain, GenericFeed feed) throws BatchInterruptedException, java.io.IOException, java.net.MalformedURLException, ServiceException
batch
instead of repeated calls to #insert
is helpful in
reducing HTTP overhead.domain
- the domain into which filters are being created.feed
- a feed containing one or more GenericEntry
objects
containing all the properties of Gmail filters,
each of which has been tagged with
BatchUtils#setBatchId(com.google.gdata.data.BaseEntry,
String)
. The batch operation type of each entry must be
BatchOperationType.INSERT
; however, there should be no
need to call BatchUtils#setBatchOperationType(
com.google.gdata.data.BaseEntry, BatchOperationType)
on each
entry, as this operation is already the default.GenericEntry
object.java.io.IOException
- if an error occurs while communicating with the GData
service.java.net.MalformedURLException
- if the batch feed URL cannot be constructed.ServiceException
- if the insert request failed due to system error.BatchInterruptedException
- if an irrecoverable error was detected
by the server while parsing the request,
like invalid XML data. Some operations
might have succeeded when this exception
is thrown. Check BatchInterruptedException.getFeed()
.