本文整理汇总了Java中com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient类的典型用法代码示例。如果您正苦于以下问题:Java AbstractGoogleJsonClient类的具体用法?Java AbstractGoogleJsonClient怎么用?Java AbstractGoogleJsonClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractGoogleJsonClient类属于com.google.api.client.googleapis.services.json包,在下文中一共展示了AbstractGoogleJsonClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
String clientAccountId = getStringInput("ClientAccountId", "Enter the Client Account ID");
List<ClientUser> allClients = adXClient.accounts().clients().users().list(accountId,
clientAccountId).execute().getUsers();
if (allClients != null && allClients.size() > 0) {
System.out.printf("========================================\n");
System.out.printf("Listing of Client Users associated with Client Account ID \"%s\"%n",
clientAccountId);
System.out.printf("========================================\n");
for (ClientUser clientUser : allClients) {
System.out.printf("User ID: %s%n", clientUser.getUserId());
System.out.printf("\tEmail: %s%n", clientUser.getEmail());
System.out.printf("\tStatus: %s%n", clientUser.getStatus());
}
} else {
System.out.println("No Client Users were found associated to this Client Buyer.");
}
}
示例2: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
long clientAccountId = getIntInput("ClientAccountId", "Enter the Client Account ID");
String email = getStringInput("Email", "Enter the email address");
ClientUserInvitation invite = new ClientUserInvitation();
invite.setEmail(email);
invite = adXClient.accounts().clients().invitations().create(accountId, clientAccountId,
invite).execute();
System.out.printf("========================================\n");
System.out.printf("Created new Invitation for Client Account ID \"%s\"%n",
clientAccountId);
System.out.printf("========================================\n");
System.out.printf("Invitations ID: %s%n", invite.getInvitationId());
System.out.printf("\tEmail: %s%n", invite.getEmail());
}
示例3: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
List<Client> allClients = adXClient.accounts().clients().list(accountId).execute().getClients();
if (allClients != null && allClients.size() > 0) {
System.out.printf("========================================\n");
System.out.printf("Listing of Client Buyers associated with AdX Account \"%s\"%n",
accountId);
System.out.printf("========================================\n");
for (Client clientBuyer : allClients) {
System.out.printf("Client Account ID: %s%n", clientBuyer.getClientAccountId());
System.out.printf("\tClient Name: %s%n", clientBuyer.getClientName());
System.out.printf("\tEntity ID: %s%n", clientBuyer.getEntityId());
System.out.printf("\tEntity Name: %s%n", clientBuyer.getEntityName());
System.out.printf("\tEntity Type: %s%n", clientBuyer.getEntityType());
System.out.printf("\tRole: %s%n", clientBuyer.getRole());
System.out.printf("\tStatus: %s%n", clientBuyer.getStatus());
}
} else {
System.out.println("No Client Buyers were found associated to this Account.");
}
}
示例4: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
String clientAccountId = getStringInput("ClientAccountId", "Enter the Client Account ID");
List<ClientUserInvitation> allInvites = adXClient.accounts().clients().invitations().list(
accountId, clientAccountId).execute().getInvitations();
if (allInvites != null && allInvites.size() > 0) {
System.out.printf("========================================\n");
System.out.printf("Listing of Invitations associated with Client Account ID \"%s\"%n",
clientAccountId);
System.out.printf("========================================\n");
for (ClientUserInvitation invite : allInvites) {
System.out.printf("Invitations ID: %s%n", invite.getInvitationId());
System.out.printf("\tEmail: %s%n", invite.getEmail());
}
} else {
System.out.println("No Invitations were found associated to this Account.");
}
}
示例5: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
long clientAccountId = getIntInput("ClientAccountId", "Enter the Client Account ID");
long userId = getIntInput("userId", "Enter the User ID");
String status = getStringInput("Status", "Enter the Status");
ClientUser clientUser = new ClientUser();
clientUser.setStatus(status);
clientUser = adXClient.accounts().clients().users().update(accountId, clientAccountId, userId,
clientUser).execute();
System.out.printf("========================================\n");
System.out.printf("Updated Client User with Client Account ID \"%s\" and User ID \"%s\"%n",
clientAccountId, clientUser.getUserId());
System.out.printf("========================================\n");
System.out.printf("User ID: %s%n", clientUser.getUserId());
System.out.printf("\tEmail: %s%n", clientUser.getEmail());
System.out.printf("\tStatus: %s%n", clientUser.getStatus());
}
示例6: prepareBuilder
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
private <T extends AbstractGoogleJsonClient.Builder> T prepareBuilder(T builder,
final HttpRequestInitializer delegate,
GoogleClientRequestInitializer googleClientRequestInitializer) {
builder
.setHttpRequestInitializer(getHttpRequestInitializer(delegate))
.setApplicationName(applicationName)
.setGoogleClientRequestInitializer(googleClientRequestInitializer);
if (rootUrl.isPresent()) {
builder.setRootUrl(rootUrl.get());
}
if (servicePath.isPresent()) {
builder.setServicePath(servicePath.get());
}
return builder;
}
示例7: setupLocalApi
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
private void setupLocalApi(AbstractGoogleJsonClient.Builder builder) {
builder.setApplicationName(appName)
.setRootUrl(rootUrl)
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
@Override
public void initialize(AbstractGoogleClientRequest<?> request) throws IOException {
request.setDisableGZipContent(true);
}
});
}
示例8: updateCredential
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
public static AbstractGoogleJsonClient updateCredential(AbstractGoogleJsonClient.Builder builder, String accountName) {
GoogleAccountCredential credential = (GoogleAccountCredential) builder.getHttpRequestInitializer();
String selectedAccountName = credential.getSelectedAccountName();
if (selectedAccountName == null || !selectedAccountName.equals(accountName)) {
credential.setSelectedAccountName(accountName);
builder.setHttpRequestInitializer(credential);
}
return builder.build();
}
示例9: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyer adXClient = (AdExchangeBuyer) client;
int accountId = getIntInput("AccountId", "Enter the account ID");
String cookieMatchingUrl =
getStringInput("CookieMatchingUrl", "Enter new cookie matching URL for the account");
Account account = new Account();
account.setId(accountId);
account.setCookieMatchingUrl(cookieMatchingUrl);
account = adXClient.accounts().patch(accountId, account).execute();
System.out.printf("Account updated!");
System.out.printf("Account ID: %d\n", account.getId());
System.out.printf("- Max. total Qps: %d\n", account.getMaximumTotalQps());
System.out.printf("- Cookie matching Nid: %s\n", account.getCookieMatchingNid());
System.out.printf("- Cookie Matching Url: %s\n", account.getCookieMatchingUrl());
List<BidderLocation> bidderLocations = account.getBidderLocation();
if (bidderLocations != null && bidderLocations.size() > 0) {
System.out.printf("- Bidder locations:\n");
for (BidderLocation bidderLocation : bidderLocations) {
System.out.printf(" - Bidder location Url: %s\n", bidderLocation.getUrl());
System.out.printf(" - Bidder location Max. Qps: %d\n", bidderLocation.getMaximumQps());
}
} else {
System.out.printf("- With no configured bidder locations\n");
}
}
示例10: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyer adXClient = (AdExchangeBuyer) client;
long accountId = getIntInput("AccountId", "Enter the creative account ID");
String startDate = getStringInput("endDateTime",
"The end date of the report (older date) - mm/dd/yyyy format");
String endDate = getStringInput("startDateTime",
"The start date of the report (end date) - mm/dd/yyyy format");
List<PerformanceReport> allReports = adXClient.
performanceReport().
list(accountId, endDate, startDate).
execute().
getPerformanceReport();
if (allReports != null && allReports.size() > 0) {
System.out.printf("========================================%n");
System.out.printf("List of performance reports for account ID \"%s\"%n",
accountId);
System.out.printf("========================================%n");
for (PerformanceReport report : allReports) {
System.out.printf("Region: %s%n", report.getRegion());
System.out.printf("\tTime Stamp: %s%n", report.getTimestamp());
System.out.printf("\tPixel Match Requests: %s%n",
report.getPixelMatchRequests());
System.out.printf("\tPixel Match Responses: %s%n",
report.getPixelMatchResponses());
}
} else {
System.out.printf("No performance reports for account ID \"%s\"%n", accountId);
}
}
示例11: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyer adXClient = (AdExchangeBuyer) client;
long accountId = getLongInput("AccountId", "Enter the account id");
String configName = getStringInput("configName",
"Enter the name for the pretargetConfig");
long width = getLongInput("AdWidth", "Enter the width to target", 300L);
long height = getLongInput("AdHeight", "Enter the height to target", 250L);
PretargetingConfig newConfig = new PretargetingConfig();
newConfig.setConfigName(configName);
newConfig.setIsActive(true);
newConfig.setCreativeType(Arrays.asList("PRETARGETING_CREATIVE_TYPE_HTML"));
Dimensions targetDimensions = new Dimensions();
targetDimensions.setWidth(width);
targetDimensions.setHeight(height);
newConfig.setDimensions(Arrays.asList(targetDimensions));
PretargetingConfig config = adXClient.pretargetingConfig().
insert(accountId, newConfig).execute();
System.out.println("========================================");
System.out.println("Inserted pretargeting config");
System.out.println("========================================");
System.out.println("Config Name: " + config.getConfigName());
System.out.println("Config Id: " + config.getConfigId());
System.out.println("Is Active: " + config.getIsActive());
System.out.println("CreativeType: " + config.getCreativeType());
System.out.println("Dimensions: ");
for (Dimensions d : config.getDimensions()) {
System.out.printf("\r%s\t%s%n", d.getWidth(), d.getHeight());
}
}
示例12: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyer adXClient = (AdExchangeBuyer) client;
List<Account> allAccounts = adXClient.accounts().list().execute().getItems();
if (allAccounts != null && allAccounts.size() > 0) {
System.out.printf("========================================\n");
System.out.printf("Listing of user associated accounts\n");
System.out.printf("========================================\n");
for (Account account : allAccounts) {
System.out.printf("Account id: %d\n", account.getId());
System.out.printf("- Max. total Qps: %d\n", account.getMaximumTotalQps());
System.out.printf("- Cookie matching Nid: %s\n", account.getCookieMatchingNid());
System.out.printf("- Cookie Matching Url: %s\n", account.getCookieMatchingUrl());
List<BidderLocation> bidderLocations = account.getBidderLocation();
if (bidderLocations != null && bidderLocations.size() > 0) {
System.out.printf("- Bidder locations:\n");
for (BidderLocation bidderLocation : bidderLocations) {
System.out.printf(" - Bidder location Url: %s\n", bidderLocation.getUrl());
System.out.printf(
" - Bidder location Max. Qps: %d\n", bidderLocation.getMaximumQps());
}
} else {
System.out.printf("- With no configured bidder locations\n");
}
}
} else {
System.out.printf("No accounts were found associated to this user\n");
}
}
示例13: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
long clientAccountId = getIntInput("ClientAccountId", "Enter the Client Account ID");
String clientName = getStringInput("ClientName", "Enter the Client Name");
long entityId = getIntInput("EntityId", "Enter the Entity ID");
String entityName = getStringInput("EntityName", "Enter the Entity Name");
String entityType = getStringInput("Entity Type", "Enter the Entity Type");
String role = getStringInput("Role", "Enter the Role");
String status = getStringInput("Status", "Enter the Status");
boolean visibleToSeller = getBooleanInput("VisibleToSeller",
"Is this account visible to seller? (true/false)", false);
Client clientBuyer = new Client();
clientBuyer.setClientName(clientName);
clientBuyer.setEntityId(entityId);
clientBuyer.setEntityName(entityName);
clientBuyer.setEntityType(entityType);
clientBuyer.setRole(role);
clientBuyer.setStatus(status);
clientBuyer.setVisibleToSeller(visibleToSeller);
clientBuyer = adXClient.accounts().clients().update(accountId, clientAccountId,
clientBuyer).execute();
System.out.printf("========================================\n");
System.out.printf("Updated Client Buyer with Client Account ID \"%s\"%n",
clientAccountId);
System.out.printf("========================================\n");
System.out.printf("Client Account ID: %s%n", clientBuyer.getClientAccountId());
System.out.printf("\tClient Name: %s%n", clientBuyer.getClientName());
System.out.printf("\tEntity ID: %s%n", clientBuyer.getEntityId());
System.out.printf("\tEntity Name: %s%n", clientBuyer.getEntityName());
System.out.printf("\tEntity Type: %s%n", clientBuyer.getEntityType());
System.out.printf("\tRole: %s%n", clientBuyer.getRole());
System.out.printf("\tStatus: %s%n", clientBuyer.getStatus()); }
示例14: execute
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
@Override
public void execute(AbstractGoogleJsonClient client) throws IOException {
AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
long accountId = getIntInput("AccountId", "Enter the Account ID");
String clientName = getStringInput("ClientName", "Enter the Client Name");
long entityId = getIntInput("EntityId", "Enter the Entity ID");
String entityName = getStringInput("EntityName", "Enter the Entity Name");
String entityType = getStringInput("Entity Type", "Enter the Entity Type");
String role = getStringInput("Role", "Enter the Role");
String status = getStringInput("Status", "Enter the Status");
boolean visibleToSeller = getBooleanInput("VisibleToSeller", "Enter VisibleToSeller", false);
Client clientBuyer = new Client();
clientBuyer.setClientName(clientName);
clientBuyer.setEntityId(entityId);
clientBuyer.setEntityName(entityName);
clientBuyer.setEntityType(entityType);
clientBuyer.setRole(role);
clientBuyer.setStatus(status);
clientBuyer.setVisibleToSeller(visibleToSeller);
clientBuyer = adXClient.accounts().clients().create(accountId, clientBuyer).execute();
System.out.printf("========================================\n");
System.out.printf("Created Client Buyer for Account ID \"%s\"%n",
accountId);
System.out.printf("========================================\n");
System.out.printf("Client Account ID: %s%n", clientBuyer.getClientAccountId());
System.out.printf("\tClient Name: %s%n", clientBuyer.getClientName());
System.out.printf("\tEntity ID: %s%n", clientBuyer.getEntityId());
System.out.printf("\tEntity Name: %s%n", clientBuyer.getEntityName());
System.out.printf("\tEntity Type: %s%n", clientBuyer.getEntityType());
System.out.printf("\tRole: %s%n", clientBuyer.getRole());
System.out.printf("\tStatus: %s%n", clientBuyer.getStatus());
}
示例15: fromClientSecretsFile
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入依赖的package包/类
/**
* Prepare an AbstractGoogleJsonClient.Builder using a {@code client_secrets.json} {@link File}.
*
* @param builder The builder to be prepared.
* @param clientSecretsJson {@code client_secrets.json} file.
* @return The passed in builder, for easy chaining.
*/
public <T extends AbstractGoogleJsonClient.Builder> T fromClientSecretsFile(T builder,
File clientSecretsJson) {
Preconditions.checkNotNull(builder);
Preconditions.checkNotNull(clientSecretsJson);
return prepareBuilder(builder,
CredentialFactory.getCredentialFromClientSecrets(clientSecretsJson.getAbsolutePath(),
applicationName),
null);
}