From a36e3b130d609dfdc5b3ac0a70ff1b014c4bc75f Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Tue, 27 Jul 2021 00:20:26 -0700 Subject: [PATCH] chore: Update discovery artifacts (#1462) ## Deleted keys were detected in the following stable discovery artifacts: sqladmin v1 https://github.com/googleapis/google-api-python-client/commit/cef24d829ab5be71563a2b668b8f6cf5dda2c8e4 ## Deleted keys were detected in the following pre-stable discovery artifacts: alertcenter v1beta1 https://github.com/googleapis/google-api-python-client/commit/70810a52c85c6d0d6f00d7afb41c8608261eaebc ## Discovery Artifact Change Summary: feat(alertcenter): update the api https://github.com/googleapis/google-api-python-client/commit/70810a52c85c6d0d6f00d7afb41c8608261eaebc feat(chat): update the api https://github.com/googleapis/google-api-python-client/commit/a577cd0b71951176bbf849c1f7f139127205da54 feat(cloudbuild): update the api https://github.com/googleapis/google-api-python-client/commit/9066056a8b106d441fb7686fe84359484d0d58bc feat(content): update the api https://github.com/googleapis/google-api-python-client/commit/b123349da33c11c0172a8efb3fadef685a30e6e1 feat(displayvideo): update the api https://github.com/googleapis/google-api-python-client/commit/c525d726ee6cffdd4bc7afd69080d5e52bae83a0 feat(dns): update the api https://github.com/googleapis/google-api-python-client/commit/13436ccd2b835fda5cb86952ac4ea991ee8651d8 feat(eventarc): update the api https://github.com/googleapis/google-api-python-client/commit/6be3394a64a5eb509f68ef779680fd36837708ee feat(file): update the api https://github.com/googleapis/google-api-python-client/commit/817a0e636771445a988ef479bd52740f754b901a feat(monitoring): update the api https://github.com/googleapis/google-api-python-client/commit/bd32149f308467f0f659119587afc77dcec65b14 feat(people): update the api https://github.com/googleapis/google-api-python-client/commit/aa6b47df40c5289f33aef6fb6aa007df2d038e20 feat(retail): update the api https://github.com/googleapis/google-api-python-client/commit/d39f06e2d77034bc837604a41dd52c577f158bf2 feat(securitycenter): update the api https://github.com/googleapis/google-api-python-client/commit/999fab5178208639c9eef289f9f441052ed832fc feat(speech): update the api https://github.com/googleapis/google-api-python-client/commit/3b2c0fa62b2a0c86bba1e97f1b18f93250dbd551 feat(sqladmin): update the api https://github.com/googleapis/google-api-python-client/commit/cef24d829ab5be71563a2b668b8f6cf5dda2c8e4 --- docs/dyn/admin_directory_v1.asps.html | 12 +- docs/dyn/admin_directory_v1.channels.html | 4 +- .../admin_directory_v1.chromeosdevices.html | 4 +- docs/dyn/admin_directory_v1.customers.html | 4 +- docs/dyn/admin_directory_v1.groups.html | 4 +- ...dmin_directory_v1.resources.buildings.html | 4 +- ...dmin_directory_v1.resources.calendars.html | 4 +- ...admin_directory_v1.resources.features.html | 4 +- .../admin_directory_v1.roleAssignments.html | 4 +- docs/dyn/admin_directory_v1.roles.html | 4 +- docs/dyn/admin_directory_v1.schemas.html | 24 +- docs/dyn/admin_directory_v1.tokens.html | 8 +- ...dmin_directory_v1.twoStepVerification.html | 4 +- .../dyn/admin_directory_v1.users.aliases.html | 4 +- docs/dyn/admin_directory_v1.users.html | 8 +- .../admin_directory_v1.verificationCodes.html | 8 +- docs/dyn/analyticsadmin_v1alpha.accounts.html | 4 +- ...dmin_v1alpha.properties.customMetrics.html | 12 +- .../androidpublisher_v3.edits.bundles.html | 10 +- docs/dyn/chat_v1.dms.conversations.html | 1050 +++++ docs/dyn/chat_v1.dms.html | 2324 ++++++++++- docs/dyn/chat_v1.rooms.conversations.html | 1050 +++++ docs/dyn/chat_v1.rooms.html | 2324 ++++++++++- docs/dyn/chat_v1.spaces.html | 1050 +++++ docs/dyn/chat_v1.spaces.messages.html | 3175 +++++++++++++-- docs/dyn/cloudasset_v1.v1.html | 4 +- docs/dyn/cloudbuild_v1.projects.builds.html | 16 + ...oudbuild_v1.projects.locations.builds.html | 16 + ...dbuild_v1.projects.locations.triggers.html | 62 +- ...ild_v1.projects.locations.workerPools.html | 2 +- docs/dyn/cloudbuild_v1.projects.triggers.html | 62 +- ...tions_v1.projects.locations.functions.html | 24 +- docs/dyn/content_v2_1.accounts.html | 65 + .../dyn/content_v2_1.freelistingsprogram.html | 146 + docs/dyn/content_v2_1.html | 10 + docs/dyn/content_v2_1.reports.html | 22 +- docs/dyn/content_v2_1.shoppingadsprogram.html | 145 + docs/dyn/datastore_v1.projects.html | 286 +- ...displayvideo_v1.advertisers.campaigns.html | 18 + ...rgetingTypes.assignedTargetingOptions.html | 42 + docs/dyn/displayvideo_v1.advertisers.html | 58 +- ...yvideo_v1.advertisers.insertionOrders.html | 18 + ...rgetingTypes.assignedTargetingOptions.html | 42 + ...displayvideo_v1.advertisers.lineItems.html | 54 + ...rgetingTypes.assignedTargetingOptions.html | 84 + ...rgetingTypes.assignedTargetingOptions.html | 92 +- docs/dyn/displayvideo_v1.partners.html | 36 + ...rgetingTypes.assignedTargetingOptions.html | 84 + ...eo_v1.targetingTypes.targetingOptions.html | 57 +- docs/dyn/dns_v1beta2.changes.html | 696 ++++ docs/dyn/dns_v1beta2.projects.html | 1 + docs/dyn/dns_v1beta2.resourceRecordSets.html | 522 +++ docs/dyn/dns_v1beta2.responsePolicyRules.html | 696 ++++ ...entarc_v1.projects.locations.channels.html | 258 ++ docs/dyn/eventarc_v1.projects.locations.html | 5 + ..._v1beta1.projects.locations.instances.html | 13 +- ...rojects.locations.instances.snapshots.html | 314 ++ ...store_v1.projects.databases.documents.html | 510 +-- ...beta1.projects.locations.services.nlp.html | 4 +- docs/dyn/index.md | 7 - docs/dyn/monitoring_v1.html | 5 + docs/dyn/monitoring_v1.locations.global_.html | 91 + ...ng_v1.locations.global_.metricsScopes.html | 155 + ...ations.global_.metricsScopes.projects.html | 170 + docs/dyn/monitoring_v1.locations.html | 91 + ...ng_v3.services.serviceLevelObjectives.html | 96 +- .../mybusinessnotifications_v1.accounts.html | 8 +- ...ebooks_v1.projects.locations.runtimes.html | 66 +- docs/dyn/people_v1.otherContacts.html | 310 +- docs/dyn/people_v1.people.connections.html | 106 +- docs/dyn/people_v1.people.html | 1534 ++++--- ...ojects.locations.caPools.certificates.html | 2 +- ...ects.locations.certificateAuthorities.html | 10 +- docs/dyn/reseller_v1.customers.html | 58 +- docs/dyn/reseller_v1.subscriptions.html | 48 +- ....locations.catalogs.branches.products.html | 970 ++++- ...cts.locations.catalogs.completionData.html | 145 + ...retail_v2.projects.locations.catalogs.html | 108 + ...rojects.locations.catalogs.placements.html | 376 +- ...rojects.locations.catalogs.userEvents.html | 327 +- ....locations.catalogs.branches.products.html | 972 ++++- ...cts.locations.catalogs.completionData.html | 145 + ...l_v2alpha.projects.locations.catalogs.html | 141 + ...rojects.locations.catalogs.placements.html | 377 +- ...rojects.locations.catalogs.userEvents.html | 327 +- ....locations.catalogs.branches.products.html | 970 ++++- ...cts.locations.catalogs.completionData.html | 145 + ...il_v2beta.projects.locations.catalogs.html | 108 + ...rojects.locations.catalogs.placements.html | 376 +- ...rojects.locations.catalogs.userEvents.html | 327 +- .../dyn/run_v1.namespaces.configurations.html | 8 +- .../dyn/run_v1.namespaces.domainmappings.html | 12 +- docs/dyn/run_v1.namespaces.revisions.html | 12 +- docs/dyn/run_v1.namespaces.routes.html | 20 +- docs/dyn/run_v1.namespaces.services.html | 64 +- ..._v1.projects.locations.configurations.html | 8 +- ..._v1.projects.locations.domainmappings.html | 12 +- .../run_v1.projects.locations.revisions.html | 12 +- .../dyn/run_v1.projects.locations.routes.html | 20 +- .../run_v1.projects.locations.services.html | 64 +- ...itycenter_v1.folders.sources.findings.html | 36 + ...ter_v1.organizations.sources.findings.html | 54 + ...tycenter_v1.projects.sources.findings.html | 36 + ...cations.namespaces.services.endpoints.html | 12 +- ...rojects.locations.namespaces.services.html | 28 +- ...cations.namespaces.services.endpoints.html | 12 +- ...rojects.locations.namespaces.services.html | 28 +- docs/dyn/slides_v1.presentations.html | 1088 ++++- docs/dyn/slides_v1.presentations.pages.html | 7 +- ...projects.instances.databases.sessions.html | 66 +- ...eta1.projects.locations.customClasses.html | 2 +- ...p1beta1.projects.locations.phraseSets.html | 2 +- docs/dyn/speech_v1p1beta1.speech.html | 14 + docs/dyn/sqladmin_v1.backupRuns.html | 419 ++ docs/dyn/sqladmin_v1.connect.html | 172 + docs/dyn/sqladmin_v1.databases.html | 573 +++ docs/dyn/sqladmin_v1.flags.html | 128 + docs/dyn/sqladmin_v1.html | 40 + docs/dyn/sqladmin_v1.instances.html | 2924 +++++++++++++- docs/dyn/sqladmin_v1.operations.html | 289 ++ docs/dyn/sqladmin_v1.projects.instances.html | 406 +- docs/dyn/sqladmin_v1.sslCerts.html | 407 ++ docs/dyn/sqladmin_v1.tiers.html | 119 + docs/dyn/sqladmin_v1.users.html | 453 +++ docs/dyn/sqladmin_v1beta4.backupRuns.html | 20 +- docs/dyn/sqladmin_v1beta4.flags.html | 6 +- docs/dyn/sqladmin_v1beta4.instances.html | 86 +- ...tainers.workspaces.built_in_variables.html | 9 + .../acceleratedmobilepageurl.v1.json | 2 +- .../documents/accessapproval.v1.json | 2 +- .../documents/accesscontextmanager.v1.json | 2 +- .../accesscontextmanager.v1beta.json | 2 +- .../documents/adexchangebuyer.v1.2.json | 4 +- .../documents/adexchangebuyer.v1.3.json | 4 +- .../documents/adexchangebuyer.v1.4.json | 4 +- .../documents/adexchangebuyer2.v2beta1.json | 2 +- .../documents/admin.datatransfer_v1.json | 4 +- .../documents/admin.directory_v1.json | 56 +- .../documents/admin.reports_v1.json | 4 +- .../discovery_cache/documents/admob.v1.json | 2 +- .../documents/admob.v1beta.json | 2 +- .../discovery_cache/documents/adsense.v2.json | 2 +- .../documents/alertcenter.v1beta1.json | 70 +- .../documents/analyticsadmin.v1alpha.json | 4 +- .../documents/analyticsdata.v1beta.json | 2 +- .../androiddeviceprovisioning.v1.json | 2 +- .../documents/androidenterprise.v1.json | 2 +- .../documents/androidpublisher.v3.json | 10 +- .../documents/apigateway.v1.json | 2 +- .../documents/apigateway.v1beta.json | 2 +- .../discovery_cache/documents/apigee.v1.json | 2 +- .../discovery_cache/documents/apikeys.v2.json | 2 +- .../documents/appengine.v1.json | 2 +- .../documents/appengine.v1alpha.json | 2 +- .../documents/appengine.v1beta.json | 2 +- .../documents/area120tables.v1alpha1.json | 2 +- .../documents/artifactregistry.v1.json | 2 +- .../documents/artifactregistry.v1beta1.json | 2 +- .../documents/artifactregistry.v1beta2.json | 2 +- .../documents/bigquery.v2.json | 2 +- .../documents/bigqueryconnection.v1beta1.json | 2 +- .../documents/bigqueryreservation.v1.json | 2 +- .../bigqueryreservation.v1beta1.json | 2 +- .../documents/bigtableadmin.v1.json | 2 +- .../documents/bigtableadmin.v2.json | 2 +- .../documents/billingbudgets.v1.json | 2 +- .../documents/billingbudgets.v1beta1.json | 2 +- .../documents/binaryauthorization.v1.json | 2 +- .../binaryauthorization.v1beta1.json | 2 +- .../discovery_cache/documents/blogger.v2.json | 2 +- .../discovery_cache/documents/blogger.v3.json | 2 +- .../discovery_cache/documents/books.v1.json | 2 +- .../documents/calendar.v3.json | 2 +- .../discovery_cache/documents/chat.v1.json | 946 ++++- .../documents/chromemanagement.v1.json | 2 +- .../documents/chromepolicy.v1.json | 2 +- .../documents/chromeuxreport.v1.json | 2 +- .../documents/classroom.v1.json | 2 +- .../documents/cloudasset.v1.json | 4 +- .../documents/cloudasset.v1beta1.json | 2 +- .../documents/cloudasset.v1p1beta1.json | 2 +- .../documents/cloudasset.v1p4beta1.json | 2 +- .../documents/cloudasset.v1p5beta1.json | 2 +- .../documents/cloudasset.v1p7beta1.json | 2 +- .../documents/cloudbuild.v1.json | 163 +- .../documents/cloudbuild.v1alpha1.json | 128 +- .../documents/cloudbuild.v1alpha2.json | 128 +- .../documents/cloudbuild.v1beta1.json | 128 +- .../documents/cloudchannel.v1.json | 2 +- .../documents/clouddebugger.v2.json | 2 +- .../documents/cloudfunctions.v1.json | 8 +- .../documents/cloudidentity.v1.json | 2 +- .../documents/cloudidentity.v1beta1.json | 2 +- .../documents/cloudiot.v1.json | 2 +- .../documents/cloudprofiler.v2.json | 2 +- .../documents/cloudresourcemanager.v1.json | 2 +- .../cloudresourcemanager.v1beta1.json | 2 +- .../documents/cloudresourcemanager.v2.json | 2 +- .../cloudresourcemanager.v2beta1.json | 2 +- .../documents/cloudresourcemanager.v3.json | 2 +- .../documents/cloudscheduler.v1.json | 2 +- .../documents/cloudscheduler.v1beta1.json | 2 +- .../documents/cloudsearch.v1.json | 2 +- .../documents/cloudtasks.v2.json | 2 +- .../documents/cloudtasks.v2beta2.json | 2 +- .../documents/cloudtasks.v2beta3.json | 2 +- .../documents/cloudtrace.v1.json | 2 +- .../documents/cloudtrace.v2.json | 2 +- .../documents/cloudtrace.v2beta1.json | 2 +- .../documents/composer.v1.json | 2 +- .../documents/composer.v1beta1.json | 2 +- .../documents/container.v1.json | 4 +- .../documents/container.v1beta1.json | 4 +- .../documents/containeranalysis.v1alpha1.json | 2 +- .../documents/containeranalysis.v1beta1.json | 2 +- .../documents/content.v2.1.json | 518 ++- .../discovery_cache/documents/content.v2.json | 2 +- .../documents/customsearch.v1.json | 2 +- .../documents/dataflow.v1b3.json | 2 +- .../documents/datalabeling.v1beta1.json | 2 +- .../documents/datamigration.v1.json | 2 +- .../documents/datamigration.v1beta1.json | 2 +- .../documents/dataproc.v1.json | 2 +- .../documents/dataproc.v1beta2.json | 2 +- .../documents/deploymentmanager.alpha.json | 2 +- .../documents/deploymentmanager.v2.json | 2 +- .../documents/deploymentmanager.v2beta.json | 2 +- .../documents/digitalassetlinks.v1.json | 2 +- .../documents/displayvideo.v1.json | 538 ++- .../discovery_cache/documents/dlp.v2.json | 2 +- .../discovery_cache/documents/dns.v1.json | 2 +- .../documents/dns.v1beta2.json | 129 +- .../discovery_cache/documents/docs.v1.json | 2 +- .../documents/documentai.v1.json | 2 +- .../documents/documentai.v1beta2.json | 2 +- .../documents/documentai.v1beta3.json | 2 +- .../documents/domains.v1alpha2.json | 2 +- .../documents/domainsrdap.v1.json | 2 +- .../documents/doubleclickbidmanager.v1.1.json | 6 +- .../documents/doubleclickbidmanager.v1.json | 2 +- .../documents/doubleclicksearch.v2.json | 2 +- .../discovery_cache/documents/drive.v2.json | 4 +- .../discovery_cache/documents/drive.v3.json | 4 +- .../documents/driveactivity.v2.json | 2 +- .../documents/essentialcontacts.v1.json | 2 +- .../documents/eventarc.v1.json | 93 +- .../documents/eventarc.v1beta1.json | 2 +- .../documents/factchecktools.v1alpha1.json | 2 +- .../discovery_cache/documents/fcm.v1.json | 2 +- .../documents/fcmdata.v1beta1.json | 2 +- .../documents/file.v1beta1.json | 245 +- .../documents/firebase.v1beta1.json | 2 +- .../documents/firebaseappcheck.v1beta.json | 2 +- .../documents/firebasedatabase.v1beta.json | 2 +- .../documents/firebasedynamiclinks.v1.json | 2 +- .../documents/firebasehosting.v1.json | 2 +- .../documents/firebasehosting.v1beta1.json | 2 +- .../documents/firebaseml.v1.json | 2 +- .../documents/firebaseml.v1beta2.json | 2 +- .../documents/firebasestorage.v1beta.json | 2 +- .../discovery_cache/documents/fitness.v1.json | 2 +- .../discovery_cache/documents/games.v1.json | 2 +- .../gamesConfiguration.v1configuration.json | 2 +- .../gamesManagement.v1management.json | 2 +- .../documents/gameservices.v1beta.json | 2 +- .../documents/genomics.v2alpha1.json | 2 +- .../discovery_cache/documents/gkehub.v1.json | 2 +- .../documents/gkehub.v1alpha.json | 2 +- .../discovery_cache/documents/gmail.v1.json | 2 +- .../documents/gmailpostmastertools.v1.json | 2 +- .../gmailpostmastertools.v1beta1.json | 2 +- .../documents/groupsmigration.v1.json | 2 +- .../documents/groupssettings.v1.json | 2 +- .../documents/healthcare.v1.json | 2 +- .../documents/healthcare.v1beta1.json | 4 +- .../documents/homegraph.v1.json | 2 +- .../discovery_cache/documents/iam.v1.json | 2 +- .../documents/iamcredentials.v1.json | 2 +- .../discovery_cache/documents/iap.v1.json | 2 +- .../documents/iap.v1beta1.json | 2 +- .../documents/ideahub.v1alpha.json | 2 +- .../discovery_cache/documents/keep.v1.json | 2 +- .../documents/language.v1.json | 2 +- .../documents/language.v1beta1.json | 2 +- .../documents/language.v1beta2.json | 2 +- .../documents/libraryagent.v1.json | 2 +- .../documents/localservices.v1.json | 2 +- .../discovery_cache/documents/logging.v2.json | 2 +- .../documents/manufacturers.v1.json | 2 +- .../documents/metastore.v1alpha.json | 8 +- .../documents/metastore.v1beta.json | 8 +- .../discovery_cache/documents/ml.v1.json | 2 +- .../documents/monitoring.v1.json | 189 +- .../documents/monitoring.v3.json | 8 +- .../mybusinessaccountmanagement.v1.json | 2 +- .../documents/mybusinesslodging.v1.json | 2 +- .../documents/mybusinessnotifications.v1.json | 12 +- .../documents/mybusinessplaceactions.v1.json | 2 +- .../documents/networkmanagement.v1beta1.json | 8 +- .../documents/notebooks.v1.json | 26 +- .../documents/ondemandscanning.v1.json | 10 +- .../documents/ondemandscanning.v1beta1.json | 10 +- .../documents/orgpolicy.v2.json | 2 +- .../discovery_cache/documents/oslogin.v1.json | 2 +- .../documents/oslogin.v1alpha.json | 2 +- .../documents/oslogin.v1beta.json | 2 +- .../documents/pagespeedonline.v5.json | 2 +- .../paymentsresellersubscription.v1.json | 2 +- .../discovery_cache/documents/people.v1.json | 14 +- .../documents/playablelocations.v3.json | 2 +- .../documents/playcustomapp.v1.json | 2 +- .../documents/policysimulator.v1.json | 2 +- .../documents/policysimulator.v1beta1.json | 2 +- .../documents/policytroubleshooter.v1.json | 2 +- .../policytroubleshooter.v1beta.json | 2 +- .../documents/privateca.v1.json | 4 +- .../documents/privateca.v1beta1.json | 4 +- .../documents/prod_tt_sasportal.v1alpha1.json | 2 +- .../discovery_cache/documents/pubsub.v1.json | 2 +- .../documents/pubsub.v1beta1a.json | 2 +- .../documents/pubsub.v1beta2.json | 2 +- .../documents/pubsublite.v1.json | 2 +- .../documents/realtimebidding.v1.json | 2 +- .../documents/realtimebidding.v1alpha.json | 2 +- .../documents/recaptchaenterprise.v1.json | 2 +- .../documents/recommender.v1.json | 2 +- .../documents/recommender.v1beta1.json | 2 +- .../documents/reseller.v1.json | 36 +- .../documents/resourcesettings.v1.json | 2 +- .../discovery_cache/documents/retail.v2.json | 1675 +++++++- .../documents/retail.v2alpha.json | 1794 ++++++++- .../documents/retail.v2beta.json | 1429 ++++++- .../discovery_cache/documents/run.v1.json | 52 +- .../documents/run.v1alpha1.json | 2 +- .../documents/runtimeconfig.v1.json | 2 +- .../documents/runtimeconfig.v1beta1.json | 2 +- .../documents/safebrowsing.v4.json | 2 +- .../discovery_cache/documents/script.v1.json | 2 +- .../documents/searchconsole.v1.json | 2 +- .../documents/secretmanager.v1.json | 2 +- .../documents/secretmanager.v1beta1.json | 2 +- .../documents/securitycenter.v1.json | 45 +- .../documents/securitycenter.v1beta1.json | 45 +- .../documents/securitycenter.v1beta2.json | 45 +- .../serviceconsumermanagement.v1.json | 2 +- .../serviceconsumermanagement.v1beta1.json | 2 +- .../documents/servicedirectory.v1.json | 6 +- .../documents/servicedirectory.v1beta1.json | 6 +- .../documents/servicemanagement.v1.json | 2 +- .../documents/servicenetworking.v1.json | 2 +- .../documents/servicenetworking.v1beta.json | 2 +- .../documents/serviceusage.v1.json | 2 +- .../documents/serviceusage.v1beta1.json | 2 +- .../discovery_cache/documents/sheets.v4.json | 2 +- .../discovery_cache/documents/slides.v1.json | 2 +- .../documents/smartdevicemanagement.v1.json | 2 +- .../discovery_cache/documents/speech.v1.json | 2 +- .../documents/speech.v1p1beta1.json | 40 +- .../documents/speech.v2beta1.json | 2 +- .../documents/sqladmin.v1.json | 3582 +++++++++++++++-- .../documents/sqladmin.v1beta4.json | 36 +- .../discovery_cache/documents/storage.v1.json | 4 +- .../documents/storagetransfer.v1.json | 2 +- .../documents/streetviewpublish.v1.json | 2 +- .../discovery_cache/documents/sts.v1.json | 2 +- .../discovery_cache/documents/sts.v1beta.json | 2 +- .../documents/tagmanager.v1.json | 2 +- .../documents/tagmanager.v2.json | 34 +- .../discovery_cache/documents/tasks.v1.json | 2 +- .../discovery_cache/documents/testing.v1.json | 2 +- .../documents/texttospeech.v1.json | 2 +- .../documents/texttospeech.v1beta1.json | 2 +- .../documents/toolresults.v1beta3.json | 2 +- .../discovery_cache/documents/tpu.v1.json | 4 +- .../documents/tpu.v1alpha1.json | 4 +- .../documents/trafficdirector.v2.json | 2 +- .../documents/vectortile.v1.json | 2 +- .../documents/videointelligence.v1.json | 2 +- .../documents/videointelligence.v1beta2.json | 2 +- .../videointelligence.v1p1beta1.json | 2 +- .../videointelligence.v1p2beta1.json | 2 +- .../videointelligence.v1p3beta1.json | 2 +- .../discovery_cache/documents/vision.v1.json | 2 +- .../documents/vision.v1p1beta1.json | 2 +- .../documents/vision.v1p2beta1.json | 2 +- .../discovery_cache/documents/webrisk.v1.json | 2 +- .../documents/workflowexecutions.v1.json | 2 +- .../documents/workflowexecutions.v1beta.json | 2 +- .../documents/workflows.v1beta.json | 2 +- .../discovery_cache/documents/youtube.v3.json | 2 +- .../documents/youtubeAnalytics.v2.json | 2 +- .../documents/youtubereporting.v1.json | 2 +- 392 files changed, 40826 insertions(+), 3748 deletions(-) create mode 100644 docs/dyn/content_v2_1.freelistingsprogram.html create mode 100644 docs/dyn/content_v2_1.shoppingadsprogram.html create mode 100644 docs/dyn/eventarc_v1.projects.locations.channels.html create mode 100644 docs/dyn/file_v1beta1.projects.locations.instances.snapshots.html create mode 100644 docs/dyn/monitoring_v1.locations.global_.html create mode 100644 docs/dyn/monitoring_v1.locations.global_.metricsScopes.html create mode 100644 docs/dyn/monitoring_v1.locations.global_.metricsScopes.projects.html create mode 100644 docs/dyn/monitoring_v1.locations.html create mode 100644 docs/dyn/retail_v2.projects.locations.catalogs.completionData.html create mode 100644 docs/dyn/retail_v2alpha.projects.locations.catalogs.completionData.html create mode 100644 docs/dyn/retail_v2beta.projects.locations.catalogs.completionData.html create mode 100644 docs/dyn/sqladmin_v1.backupRuns.html create mode 100644 docs/dyn/sqladmin_v1.connect.html create mode 100644 docs/dyn/sqladmin_v1.databases.html create mode 100644 docs/dyn/sqladmin_v1.flags.html create mode 100644 docs/dyn/sqladmin_v1.operations.html create mode 100644 docs/dyn/sqladmin_v1.sslCerts.html create mode 100644 docs/dyn/sqladmin_v1.tiers.html create mode 100644 docs/dyn/sqladmin_v1.users.html diff --git a/docs/dyn/admin_directory_v1.asps.html b/docs/dyn/admin_directory_v1.asps.html index ebf5f9fb8cb..d550b010139 100644 --- a/docs/dyn/admin_directory_v1.asps.html +++ b/docs/dyn/admin_directory_v1.asps.html @@ -79,13 +79,13 @@
Close httplib2 connections.
delete(userKey, codeId, x__xgafv=None)
Delete an ASP issued by a user.
+Deletes an ASP issued by a user.
get(userKey, codeId, x__xgafv=None)
Get information about an ASP issued by a user.
+Gets information about an ASP issued by a user.
-List the ASPs issued by a user.
+Lists the ASPs issued by a user.
close()
@@ -94,7 +94,7 @@ delete(userKey, codeId, x__xgafv=None)
- Delete an ASP issued by a user. +Deletes an ASP issued by a user. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) @@ -108,7 +108,7 @@Method Details
get(userKey, codeId, x__xgafv=None)
-Get information about an ASP issued by a user. +Gets information about an ASP issued by a user. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) @@ -134,7 +134,7 @@Method Details
list(userKey, x__xgafv=None)
-List the ASPs issued by a user. +Lists the ASPs issued by a user. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) diff --git a/docs/dyn/admin_directory_v1.channels.html b/docs/dyn/admin_directory_v1.channels.html index e7d3db32dc6..09c2fdee01b 100644 --- a/docs/dyn/admin_directory_v1.channels.html +++ b/docs/dyn/admin_directory_v1.channels.html @@ -79,7 +79,7 @@Instance Methods
Close httplib2 connections.
-
stop(body=None, x__xgafv=None)
Stop watching resources through this channel.
+Stops watching resources through this channel.
Method Details
close()
@@ -88,7 +88,7 @@Method Details
stop(body=None, x__xgafv=None)
-Stop watching resources through this channel. +Stops watching resources through this channel. Args: body: object, The request body. diff --git a/docs/dyn/admin_directory_v1.chromeosdevices.html b/docs/dyn/admin_directory_v1.chromeosdevices.html index dfe6ef7ba48..f7a6fcea8a2 100644 --- a/docs/dyn/admin_directory_v1.chromeosdevices.html +++ b/docs/dyn/admin_directory_v1.chromeosdevices.html @@ -91,7 +91,7 @@Instance Methods
Retrieves the next page of results.
-
moveDevicesToOu(customerId, orgUnitPath, body=None, x__xgafv=None)
Move or insert multiple Chrome OS devices to an organizational unit. You can move up to 50 devices at once.
+Moves or inserts multiple Chrome OS devices to an organizational unit. You can move up to 50 devices at once.
patch(customerId, deviceId, body=None, projection=None, x__xgafv=None)
Updates a device's updatable properties, such as `annotatedUser`, `annotatedLocation`, `notes`, `orgUnitPath`, or `annotatedAssetId`. This method supports [patch semantics](/admin-sdk/directory/v1/guides/performance#patch).
@@ -417,7 +417,7 @@Method Details
moveDevicesToOu(customerId, orgUnitPath, body=None, x__xgafv=None)
-Move or insert multiple Chrome OS devices to an organizational unit. You can move up to 50 devices at once. +Moves or inserts multiple Chrome OS devices to an organizational unit. You can move up to 50 devices at once. Args: customerId: string, Immutable ID of the Google Workspace account (required) diff --git a/docs/dyn/admin_directory_v1.customers.html b/docs/dyn/admin_directory_v1.customers.html index 186f08a75d4..0acd76584b6 100644 --- a/docs/dyn/admin_directory_v1.customers.html +++ b/docs/dyn/admin_directory_v1.customers.html @@ -87,7 +87,7 @@Instance Methods
Retrieves a customer.
-
patch(customerKey, body=None, x__xgafv=None)
Patch Customers via Apiary Patch Orchestration
+Patches a customer.
update(customerKey, body=None, x__xgafv=None)
Updates a customer.
@@ -136,7 +136,7 @@Method Details
patch(customerKey, body=None, x__xgafv=None)
-Patch Customers via Apiary Patch Orchestration +Patches a customer. Args: customerKey: string, Id of the customer to be updated (required) diff --git a/docs/dyn/admin_directory_v1.groups.html b/docs/dyn/admin_directory_v1.groups.html index c13d4ea9ac8..bd2d85558d1 100644 --- a/docs/dyn/admin_directory_v1.groups.html +++ b/docs/dyn/admin_directory_v1.groups.html @@ -93,7 +93,7 @@Instance Methods
Creates a group.
-Retrieve all groups of a domain or of a user given a userKey (paginated)
+Retrieves all groups of a domain or of a user given a userKey (paginated).
list_next(previous_request, previous_response)
Retrieves the next page of results.
@@ -207,7 +207,7 @@Method Details
list(customer=None, domain=None, maxResults=None, orderBy=None, pageToken=None, query=None, sortOrder=None, userKey=None, x__xgafv=None)
-Retrieve all groups of a domain or of a user given a userKey (paginated) +Retrieves all groups of a domain or of a user given a userKey (paginated). Args: customer: string, The unique ID for the customer's Google Workspace account. In case of a multi-domain account, to fetch all groups for a customer, fill this field instead of domain. As an account administrator, you can also use the `my_customer` alias to represent your account's `customerId`. The `customerId` is also returned as part of the [Users](/admin-sdk/directory/v1/reference/users) diff --git a/docs/dyn/admin_directory_v1.resources.buildings.html b/docs/dyn/admin_directory_v1.resources.buildings.html index c0125ebc6f8..e2a8132e03b 100644 --- a/docs/dyn/admin_directory_v1.resources.buildings.html +++ b/docs/dyn/admin_directory_v1.resources.buildings.html @@ -94,7 +94,7 @@Instance Methods
Retrieves the next page of results.
-
patch(customer, buildingId, body=None, coordinatesSource=None, x__xgafv=None)
Patches a building via Apiary Patch Orchestration.
+Patches a building.
update(customer, buildingId, body=None, coordinatesSource=None, x__xgafv=None)
Updates a building.
@@ -301,7 +301,7 @@Method Details
patch(customer, buildingId, body=None, coordinatesSource=None, x__xgafv=None)
-Patches a building via Apiary Patch Orchestration. +Patches a building. Args: customer: string, The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID. (required) diff --git a/docs/dyn/admin_directory_v1.resources.calendars.html b/docs/dyn/admin_directory_v1.resources.calendars.html index 23790b7d0ca..1984e484880 100644 --- a/docs/dyn/admin_directory_v1.resources.calendars.html +++ b/docs/dyn/admin_directory_v1.resources.calendars.html @@ -94,7 +94,7 @@Instance Methods
Retrieves the next page of results.
-
patch(customer, calendarResourceId, body=None, x__xgafv=None)
Patches a calendar resource via Apiary Patch Orchestration.
+Patches a calendar resource.
update(customer, calendarResourceId, body=None, x__xgafv=None)
Updates a calendar resource. This method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved.
@@ -266,7 +266,7 @@Method Details
patch(customer, calendarResourceId, body=None, x__xgafv=None)
-Patches a calendar resource via Apiary Patch Orchestration. +Patches a calendar resource. Args: customer: string, The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID. (required) diff --git a/docs/dyn/admin_directory_v1.resources.features.html b/docs/dyn/admin_directory_v1.resources.features.html index 30178cf8fae..c361db118a6 100644 --- a/docs/dyn/admin_directory_v1.resources.features.html +++ b/docs/dyn/admin_directory_v1.resources.features.html @@ -94,7 +94,7 @@Instance Methods
Retrieves the next page of results.
-
patch(customer, featureKey, body=None, x__xgafv=None)
Patches a feature via Apiary Patch Orchestration.
+Patches a feature.
rename(customer, oldName, body=None, x__xgafv=None)
Renames a feature.
@@ -219,7 +219,7 @@Method Details
patch(customer, featureKey, body=None, x__xgafv=None)
-Patches a feature via Apiary Patch Orchestration. +Patches a feature. Args: customer: string, The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID. (required) diff --git a/docs/dyn/admin_directory_v1.roleAssignments.html b/docs/dyn/admin_directory_v1.roleAssignments.html index 07fbdcbc095..afe5657fbbd 100644 --- a/docs/dyn/admin_directory_v1.roleAssignments.html +++ b/docs/dyn/admin_directory_v1.roleAssignments.html @@ -82,7 +82,7 @@Instance Methods
Deletes a role assignment.
-
get(customer, roleAssignmentId, x__xgafv=None)
Retrieve a role assignment.
+Retrieves a role assignment.
insert(customer, body=None, x__xgafv=None)
Creates a role assignment.
@@ -114,7 +114,7 @@Method Details
get(customer, roleAssignmentId, x__xgafv=None)
-Retrieve a role assignment. +Retrieves a role assignment. Args: customer: string, Immutable ID of the Google Workspace account. (required) diff --git a/docs/dyn/admin_directory_v1.roles.html b/docs/dyn/admin_directory_v1.roles.html index 91ba4c997fa..0cc6a5726ea 100644 --- a/docs/dyn/admin_directory_v1.roles.html +++ b/docs/dyn/admin_directory_v1.roles.html @@ -94,7 +94,7 @@Instance Methods
Retrieves the next page of results.
-
patch(customer, roleId, body=None, x__xgafv=None)
Patch role via Apiary Patch Orchestration
+Patches a role.
update(customer, roleId, body=None, x__xgafv=None)
Updates a role.
@@ -256,7 +256,7 @@Method Details
patch(customer, roleId, body=None, x__xgafv=None)
-Patch role via Apiary Patch Orchestration +Patches a role. Args: customer: string, Immutable ID of the Google Workspace account. (required) diff --git a/docs/dyn/admin_directory_v1.schemas.html b/docs/dyn/admin_directory_v1.schemas.html index 9abf0780096..b4f84259ffb 100644 --- a/docs/dyn/admin_directory_v1.schemas.html +++ b/docs/dyn/admin_directory_v1.schemas.html @@ -79,22 +79,22 @@Instance Methods
Close httplib2 connections.
-
delete(customerId, schemaKey, x__xgafv=None)
Delete schema
+Deletes a schema.
-
get(customerId, schemaKey, x__xgafv=None)
Retrieve schema
+Retrieves a schema.
-
insert(customerId, body=None, x__xgafv=None)
Create schema.
+Creates a schema.
-
list(customerId, x__xgafv=None)
Retrieve all schemas for a customer
+Retrieves all schemas for a customer.
-
patch(customerId, schemaKey, body=None, x__xgafv=None)
Patch Schema via Apiary Patch Orchestration
+Patches a schema.
-
update(customerId, schemaKey, body=None, x__xgafv=None)
Update schema
+Updates a schema.
Method Details
close()
@@ -103,7 +103,7 @@Method Details
delete(customerId, schemaKey, x__xgafv=None)
-Delete schema +Deletes a schema. Args: customerId: string, Immutable ID of the Google Workspace account. (required) @@ -117,7 +117,7 @@Method Details
get(customerId, schemaKey, x__xgafv=None)
-Retrieve schema +Retrieves a schema. Args: customerId: string, Immutable ID of the Google Workspace account. (required) @@ -158,7 +158,7 @@Method Details
insert(customerId, body=None, x__xgafv=None)
-Create schema. +Creates a schema. Args: customerId: string, Immutable ID of the Google Workspace account. (required) @@ -226,7 +226,7 @@Method Details
list(customerId, x__xgafv=None)
-Retrieve all schemas for a customer +Retrieves all schemas for a customer. Args: customerId: string, Immutable ID of the Google Workspace account. (required) @@ -272,7 +272,7 @@Method Details
patch(customerId, schemaKey, body=None, x__xgafv=None)
-Patch Schema via Apiary Patch Orchestration +Patches a schema. Args: customerId: string, Immutable ID of the Google Workspace account. (required) @@ -341,7 +341,7 @@Method Details
update(customerId, schemaKey, body=None, x__xgafv=None)
-Update schema +Updates a schema. Args: customerId: string, Immutable ID of the Google Workspace account. (required) diff --git a/docs/dyn/admin_directory_v1.tokens.html b/docs/dyn/admin_directory_v1.tokens.html index f54c70d9307..ffdae350a31 100644 --- a/docs/dyn/admin_directory_v1.tokens.html +++ b/docs/dyn/admin_directory_v1.tokens.html @@ -79,10 +79,10 @@Instance Methods
Close httplib2 connections.
-
delete(userKey, clientId, x__xgafv=None)
Delete all access tokens issued by a user for an application.
+Deletes all access tokens issued by a user for an application.
-
get(userKey, clientId, x__xgafv=None)
Get information about an access token issued by a user.
+Gets information about an access token issued by a user.
Returns the set of tokens specified user has issued to 3rd party applications.
@@ -94,7 +94,7 @@Method Details
delete(userKey, clientId, x__xgafv=None)
-Delete all access tokens issued by a user for an application. +Deletes all access tokens issued by a user for an application. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) @@ -108,7 +108,7 @@Method Details
get(userKey, clientId, x__xgafv=None)
-Get information about an access token issued by a user. +Gets information about an access token issued by a user. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) diff --git a/docs/dyn/admin_directory_v1.twoStepVerification.html b/docs/dyn/admin_directory_v1.twoStepVerification.html index a52e093c6c9..f5c168fd846 100644 --- a/docs/dyn/admin_directory_v1.twoStepVerification.html +++ b/docs/dyn/admin_directory_v1.twoStepVerification.html @@ -79,7 +79,7 @@Instance Methods
Close httplib2 connections.
-
turnOff(userKey, x__xgafv=None)
Turn off 2-Step Verification for user.
+Turns off 2-Step Verification for user.
Method Details
close()
@@ -88,7 +88,7 @@Method Details
turnOff(userKey, x__xgafv=None)
-Turn off 2-Step Verification for user. +Turns off 2-Step Verification for user. Args: userKey: string, Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) diff --git a/docs/dyn/admin_directory_v1.users.aliases.html b/docs/dyn/admin_directory_v1.users.aliases.html index 6bc50e78d7f..619d5641bf1 100644 --- a/docs/dyn/admin_directory_v1.users.aliases.html +++ b/docs/dyn/admin_directory_v1.users.aliases.html @@ -88,7 +88,7 @@Instance Methods
Lists all aliases for a user.
-
watch(userKey, body=None, event=None, x__xgafv=None)
Watch for changes in users list.
+Watches for changes in users list.
Method Details
close()
@@ -172,7 +172,7 @@Method Details
watch(userKey, body=None, event=None, x__xgafv=None)
-Watch for changes in users list. +Watches for changes in users list. Args: userKey: string, Email or immutable ID of the user (required) diff --git a/docs/dyn/admin_directory_v1.users.html b/docs/dyn/admin_directory_v1.users.html index a7cad606b22..481edf6c445 100644 --- a/docs/dyn/admin_directory_v1.users.html +++ b/docs/dyn/admin_directory_v1.users.html @@ -110,7 +110,7 @@Instance Methods
Updates a user using patch semantics. The update method should be used instead, since it also supports patch semantics and has better performance. This method is unable to clear fields that contain repeated objects (`addresses`, `phones`, etc). Use the update method instead.
-
signOut(userKey, x__xgafv=None)
Sign a user out of all web and device sessions and reset their sign-in cookies. User will have to sign in by authenticating again.
+Signs a user out of all web and device sessions and reset their sign-in cookies. User will have to sign in by authenticating again.
undelete(userKey, body=None, x__xgafv=None)
Undeletes a deleted user.
@@ -119,7 +119,7 @@Instance Methods
Updates a user. This method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved, and fields set to `null` will be cleared.
-Watch for changes in users list
+Watches for changes in users list.
Method Details
close()
@@ -655,7 +655,7 @@Method Details
signOut(userKey, x__xgafv=None)
-Sign a user out of all web and device sessions and reset their sign-in cookies. User will have to sign in by authenticating again. +Signs a user out of all web and device sessions and reset their sign-in cookies. User will have to sign in by authenticating again. Args: userKey: string, Identifies the target user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. (required) @@ -828,7 +828,7 @@Method Details
watch(body=None, customFieldMask=None, customer=None, domain=None, event=None, maxResults=None, orderBy=None, pageToken=None, projection=None, query=None, showDeleted=None, sortOrder=None, viewType=None, x__xgafv=None)
-Watch for changes in users list +Watches for changes in users list. Args: body: object, The request body. diff --git a/docs/dyn/admin_directory_v1.verificationCodes.html b/docs/dyn/admin_directory_v1.verificationCodes.html index e04a579ebbe..d78c1199c1b 100644 --- a/docs/dyn/admin_directory_v1.verificationCodes.html +++ b/docs/dyn/admin_directory_v1.verificationCodes.html @@ -79,10 +79,10 @@Instance Methods
Close httplib2 connections.
-
generate(userKey, x__xgafv=None)
Generate new backup verification codes for the user.
+Generates new backup verification codes for the user.
-
invalidate(userKey, x__xgafv=None)
Invalidate the current backup verification codes for the user.
+Invalidates the current backup verification codes for the user.
Returns the current set of valid backup verification codes for the specified user.
@@ -94,7 +94,7 @@Method Details
generate(userKey, x__xgafv=None)
-Generate new backup verification codes for the user. +Generates new backup verification codes for the user. Args: userKey: string, Email or immutable ID of the user (required) @@ -107,7 +107,7 @@Method Details
+ +invalidate(userKey, x__xgafv=None)
-Invalidate the current backup verification codes for the user. +Invalidates the current backup verification codes for the user. Args: userKey: string, Email or immutable ID of the user (required) diff --git a/docs/dyn/analyticsadmin_v1alpha.accounts.html b/docs/dyn/analyticsadmin_v1alpha.accounts.html index deae01401cf..00a4c19511d 100644 --- a/docs/dyn/analyticsadmin_v1alpha.accounts.html +++ b/docs/dyn/analyticsadmin_v1alpha.accounts.html @@ -374,7 +374,7 @@+Method Details
"customMetric": { # A definition for a custom metric. # A snapshot of a CustomMetric resource in change history. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -491,7 +491,7 @@Method Details
"customMetric": { # A definition for a custom metric. # A snapshot of a CustomMetric resource in change history. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. diff --git a/docs/dyn/analyticsadmin_v1alpha.properties.customMetrics.html b/docs/dyn/analyticsadmin_v1alpha.properties.customMetrics.html index 9355f25fe61..04244525a6c 100644 --- a/docs/dyn/analyticsadmin_v1alpha.properties.customMetrics.html +++ b/docs/dyn/analyticsadmin_v1alpha.properties.customMetrics.html @@ -137,7 +137,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -154,7 +154,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -178,7 +178,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -206,7 +206,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -242,7 +242,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. @@ -260,7 +260,7 @@Method Details
{ # A definition for a custom metric. "description": "A String", # Optional. Description for this custom dimension. Max length of 150 characters. "displayName": "A String", # Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. - "measurementUnit": "A String", # Required. Immutable. The type for the custom metric's value. + "measurementUnit": "A String", # Required. The type for the custom metric's value. "name": "A String", # Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} "parameterName": "A String", # Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. "scope": "A String", # Required. Immutable. The scope of this custom metric. diff --git a/docs/dyn/androidpublisher_v3.edits.bundles.html b/docs/dyn/androidpublisher_v3.edits.bundles.html index bf116370012..9833684259c 100644 --- a/docs/dyn/androidpublisher_v3.edits.bundles.html +++ b/docs/dyn/androidpublisher_v3.edits.bundles.html @@ -104,9 +104,9 @@Method Details
Returns: An object of the form: - { # Response listing all bundles. - "bundles": [ # All bundles. - { # Information about a bundle. The resource for BundlesService. + { # Response listing all app bundles. + "bundles": [ # All app bundles. + { # Information about an app bundle. The resource for BundlesService. "sha1": "A String", # A sha1 hash of the upload payload, encoded as a hex string and matching the output of the sha1sum command. "sha256": "A String", # A sha256 hash of the upload payload, encoded as a hex string and matching the output of the sha256sum command. "versionCode": 42, # The version code of the Android App Bundle, as specified in the Android App Bundle's base module APK manifest file. @@ -123,7 +123,7 @@Method Details
Args: packageName: string, Package name of the app. (required) editId: string, Identifier of the edit. (required) - ackBundleInstallationWarning: boolean, Must be set to true if the bundle installation may trigger a warning on user devices (for example, if installation size may be over a threshold, typically 100 MB). + ackBundleInstallationWarning: boolean, Must be set to true if the app bundle installation may trigger a warning on user devices (for example, if installation size may be over a threshold, typically 100 MB). media_body: string, The filename of the media request body, or an instance of a MediaUpload object. media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. x__xgafv: string, V1 error format. @@ -134,7 +134,7 @@Method Details
Returns: An object of the form: - { # Information about a bundle. The resource for BundlesService. + { # Information about an app bundle. The resource for BundlesService. "sha1": "A String", # A sha1 hash of the upload payload, encoded as a hex string and matching the output of the sha1sum command. "sha256": "A String", # A sha256 hash of the upload payload, encoded as a hex string and matching the output of the sha256sum command. "versionCode": 42, # The version code of the Android App Bundle, as specified in the Android App Bundle's base module APK manifest file. diff --git a/docs/dyn/chat_v1.dms.conversations.html b/docs/dyn/chat_v1.dms.conversations.html index 7ea2a8c123a..032169e0675 100644 --- a/docs/dyn/chat_v1.dms.conversations.html +++ b/docs/dyn/chat_v1.dms.conversations.html @@ -97,6 +97,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -345,6 +870,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/chat_v1.dms.html b/docs/dyn/chat_v1.dms.html index 060f7d463f1..83b6c15cb89 100644 --- a/docs/dyn/chat_v1.dms.html +++ b/docs/dyn/chat_v1.dms.html @@ -105,6 +105,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -353,6 +878,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -452,156 +1502,681 @@Method Details
}, ], }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + ], + "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. + "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. + "imageUrl": "A String", # The URL of the image. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. + "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "imageButton": { # An image button with an onclick action. # A button with image and onclick action. + "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. + "iconUrl": "A String", # The icon specified by a URL. + "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "content": "A String", # The text of the content. Formatted text supported and always required. + "contentMultiline": True or False, # If the content should be multiline. + "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. + "iconUrl": "A String", # The icon specified by a URL. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "topLabel": "A String", # The text of the top label. Formatted text supported. + }, + "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. + "text": "A String", + }, + }, + ], + }, + ], + }, + ], + "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. + "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). + "name": "A String", + "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. + "sender": { # A user in Google Chat. # The user who created the message. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. + "commandId": "A String", # The id of the slash command invoked. + }, + "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. + "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. + "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs + "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. + "threaded": True or False, # Whether the messages are threaded in this space. + "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. + }, + "text": "A String", # Plain-text body of the message. + "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. + "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 + }, +}+- -webhooks(parent, body=None, threadKey=None, x__xgafv=None)
+Legacy path for creating message. Calling these will result in a BadRequest response. + +Args: + parent: string, Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY (required) + body: object, The request body. + The object takes the form of: + +{ # A message in Hangouts Chat. + "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. - }, - }, - ], - "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. - "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. - "imageUrl": "A String", # The URL of the image. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. - }, - ], - }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "title": "A String", # The text that displays in the grid header. }, - }, - }, - "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. - "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. - "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. - "imageButton": { # An image button with an onclick action. # A button with image and onclick action. - "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. - "iconUrl": "A String", # The icon specified by a URL. - "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. }, - }, - "content": "A String", # The text of the content. Formatted text supported and always required. - "contentMultiline": True or False, # If the content should be multiline. - "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. - "iconUrl": "A String", # The icon specified by a URL. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. }, ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. }, }, - "topLabel": "A String", # The text of the top label. Formatted text supported. - }, - "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. - "text": "A String", - }, + ], }, ], }, - ], + }, }, - ], - "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. - "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). - "name": "A String", - "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. - "sender": { # A user in Google Chat. # The user who created the message. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. - "commandId": "A String", # The id of the slash command invoked. - }, - "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. - "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. - "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs - "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. - "threaded": True or False, # Whether the messages are threaded in this space. - "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. - }, - "text": "A String", # Plain-text body of the message. - "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. - "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 - }, -}--+ +webhooks(parent, body=None, threadKey=None, x__xgafv=None)
-Legacy path for creating message. Calling these will result in a BadRequest response. - -Args: - parent: string, Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY (required) - body: object, The request body. - The object takes the form of: - -{ # A message in Hangouts Chat. - "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -850,6 +2425,531 @@+Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/chat_v1.rooms.conversations.html b/docs/dyn/chat_v1.rooms.conversations.html index 835c91525e1..e888e5d63df 100644 --- a/docs/dyn/chat_v1.rooms.conversations.html +++ b/docs/dyn/chat_v1.rooms.conversations.html @@ -97,6 +97,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -345,6 +870,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/chat_v1.rooms.html b/docs/dyn/chat_v1.rooms.html index d10eab55270..c58c8206351 100644 --- a/docs/dyn/chat_v1.rooms.html +++ b/docs/dyn/chat_v1.rooms.html @@ -105,6 +105,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -353,6 +878,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -452,156 +1502,681 @@Method Details
}, ], }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + ], + "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. + "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. + "imageUrl": "A String", # The URL of the image. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. + "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "imageButton": { # An image button with an onclick action. # A button with image and onclick action. + "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. + "iconUrl": "A String", # The icon specified by a URL. + "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "content": "A String", # The text of the content. Formatted text supported and always required. + "contentMultiline": True or False, # If the content should be multiline. + "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. + "iconUrl": "A String", # The icon specified by a URL. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "topLabel": "A String", # The text of the top label. Formatted text supported. + }, + "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. + "text": "A String", + }, + }, + ], + }, + ], + }, + ], + "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. + "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). + "name": "A String", + "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. + "sender": { # A user in Google Chat. # The user who created the message. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. + "commandId": "A String", # The id of the slash command invoked. + }, + "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. + "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. + "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs + "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. + "threaded": True or False, # Whether the messages are threaded in this space. + "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. + }, + "text": "A String", # Plain-text body of the message. + "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. + "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 + }, +}+- -webhooks(parent, body=None, threadKey=None, x__xgafv=None)
+Legacy path for creating message. Calling these will result in a BadRequest response. + +Args: + parent: string, Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY (required) + body: object, The request body. + The object takes the form of: + +{ # A message in Hangouts Chat. + "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. - }, - }, - ], - "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. - "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. - "imageUrl": "A String", # The URL of the image. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. - }, - ], - }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "title": "A String", # The text that displays in the grid header. }, - }, - }, - "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. - "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. - "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. - "imageButton": { # An image button with an onclick action. # A button with image and onclick action. - "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. - "iconUrl": "A String", # The icon specified by a URL. - "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. }, - }, - "content": "A String", # The text of the content. Formatted text supported and always required. - "contentMultiline": True or False, # If the content should be multiline. - "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. - "iconUrl": "A String", # The icon specified by a URL. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. }, ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. }, }, - "topLabel": "A String", # The text of the top label. Formatted text supported. - }, - "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. - "text": "A String", - }, + ], }, ], }, - ], + }, }, - ], - "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. - "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). - "name": "A String", - "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. - "sender": { # A user in Google Chat. # The user who created the message. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. - "commandId": "A String", # The id of the slash command invoked. - }, - "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. - "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. - "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs - "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. - "threaded": True or False, # Whether the messages are threaded in this space. - "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. - }, - "text": "A String", # Plain-text body of the message. - "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. - "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 - }, -}--+ +webhooks(parent, body=None, threadKey=None, x__xgafv=None)
-Legacy path for creating message. Calling these will result in a BadRequest response. - -Args: - parent: string, Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY (required) - body: object, The request body. - The object takes the form of: - -{ # A message in Hangouts Chat. - "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -850,6 +2425,531 @@+Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/chat_v1.spaces.html b/docs/dyn/chat_v1.spaces.html index d987d9dcce3..9aa3452df06 100644 --- a/docs/dyn/chat_v1.spaces.html +++ b/docs/dyn/chat_v1.spaces.html @@ -182,6 +182,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -430,6 +955,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/chat_v1.spaces.messages.html b/docs/dyn/chat_v1.spaces.messages.html index bd701f548ef..b21bf86426a 100644 --- a/docs/dyn/chat_v1.spaces.messages.html +++ b/docs/dyn/chat_v1.spaces.messages.html @@ -111,6 +111,1304 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, + "type": "A String", # The type of bot response. + "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) + }, + "annotations": [ # Output only. Annotations associated with the text in this message. + { # Annotations associated with the plain-text body of the message. Example plain-text message body: ``` Hello @FooBot how are you!" ``` The corresponding annotations metadata: ``` "annotations":[{ "type":"USER_MENTION", "startIndex":6, "length":7, "userMention": { "user": { "name":"users/107946847022116401880", "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" }, "type":"MENTION" } }] ``` + "length": 42, # Length of the substring in the plain-text message body this annotation corresponds to. + "slashCommand": { # Annotation metadata for slash commands (/). # The metadata for a slash command. + "bot": { # A user in Google Chat. # The bot whose command was invoked. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + "commandId": "A String", # The command id of the invoked slash command. + "commandName": "A String", # The name of the invoked slash command. + "triggersDialog": True or False, # Indicating whether the slash command is for a dialog. + "type": "A String", # The type of slash command. + }, + "startIndex": 42, # Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to. + "type": "A String", # The type of this annotation. + "userMention": { # Annotation metadata for user mentions (@). # The metadata of user mention. + "type": "A String", # The type of user mention. + "user": { # A user in Google Chat. # The user mentioned. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + }, + }, + ], + "argumentText": "A String", # Plain-text body of the message with all bot mentions stripped out. + "attachment": [ # User uploaded attachment. + { # An attachment in Hangouts Chat. + "attachmentDataRef": { # A reference to the data of an attachment. # A reference to the attachment data. This is used with the media API to download the attachment data. + "resourceName": "A String", # The resource name of the attachment data. This is used with the media API to download the attachment data. + }, + "contentName": "A String", # The original file name for the content, not the full path. + "contentType": "A String", # The content type (MIME type) of the file. + "downloadUri": "A String", # Output only. The download URL which should be used to allow a human user to download the attachment. Bots should not use this URL to download attachment content. + "driveDataRef": { # A reference to the data of a drive attachment. # A reference to the drive attachment. This is used with the Drive API. + "driveFileId": "A String", # The id for the drive file, for use with the Drive API. + }, + "name": "A String", # Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*". + "source": "A String", # The source of the attachment. + "thumbnailUri": "A String", # Output only. The thumbnail URL which should be used to preview the attachment to a human user. Bots should not use this URL to download attachment content. + }, + ], + "cards": [ # Rich, formatted and interactive cards that can be used to display UI elements such as: formatted texts, buttons, clickable images. Cards are normally displayed below the plain-text body of the message. + { # A card is a UI element that can contain UI widgets such as texts, images. + "cardActions": [ # The actions of this card. + { # A card action is the action associated with the card. For an invoice card, a typical action would be: delete invoice, email invoice or open the invoice in browser. + "actionLabel": "A String", # The label used to be displayed in the action menu item. + "onClick": { # An onclick action (e.g. open a link). # The onclick action for this action item. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + ], + "header": { # The header of the card. A header usually contains a title and an image. + "imageStyle": "A String", # The image's type (e.g. square border or circular border). + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title must be specified. The header has a fixed height: if both a title and subtitle is specified, each will take up 1 line. If only the title is specified, it will take up both lines. + }, + "name": "A String", # Name of the card. + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered (vertically) in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties (e.g. float). + "header": "A String", # The header of the section, text formatted supported. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttons": [ # A list of buttons. Buttons is also oneof data and only one of these fields should be set. + { # A button. Can be a text button or an image button. + "imageButton": { # An image button with an onclick action. # A button with image and onclick action. + "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. + "iconUrl": "A String", # The icon specified by a URL. + "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + ], + "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. + "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. + "imageUrl": "A String", # The URL of the image. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. + "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "imageButton": { # An image button with an onclick action. # A button with image and onclick action. + "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. + "iconUrl": "A String", # The icon specified by a URL. + "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + }, + "textButton": { # A button with text and onclick action. # A button with text and onclick action. + "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "content": "A String", # The text of the content. Formatted text supported and always required. + "contentMultiline": True or False, # If the content should be multiline. + "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. + "iconUrl": "A String", # The icon specified by a URL. + "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. + "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. + "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + }, + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "topLabel": "A String", # The text of the top label. Formatted text supported. + }, + "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. + "text": "A String", + }, + }, + ], + }, + ], + }, + ], + "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. + "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). + "name": "A String", + "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. + "sender": { # A user in Google Chat. # The user who created the message. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. + "commandId": "A String", # The id of the slash command invoked. + }, + "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. + "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. + "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs + "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. + "threaded": True or False, # Whether the messages are threaded in this space. + "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. + }, + "text": "A String", # Plain-text body of the message. + "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. + "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 + }, +} + + threadKey: string, Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message. + x__xgafv: string, V1 error format. + Allowed values + 1 - v1 error format + 2 - v2 error format + +Returns: + An object of the form: + + { # A message in Hangouts Chat. + "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -306,59 +1604,608 @@Method Details
}, ], }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "url": "A String", # The URL to open. + }, + }, + "topLabel": "A String", # The text of the top label. Formatted text supported. + }, + "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. + "text": "A String", + }, + }, + ], + }, + ], + }, + ], + "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. + "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). + "name": "A String", + "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. + "sender": { # A user in Google Chat. # The user who created the message. + "displayName": "A String", # The user's display name. + "domainId": "A String", # Obfuscated domain information. + "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. + "name": "A String", # Resource name, in the format "users/*". + "type": "A String", # User type. + }, + "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. + "commandId": "A String", # The id of the slash command invoked. + }, + "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. + "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. + "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs + "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. + "threaded": True or False, # Whether the messages are threaded in this space. + "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. + }, + "text": "A String", # Plain-text body of the message. + "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. + "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 + }, +}++ +delete(name, x__xgafv=None)
+Deletes a message. + +Args: + name: string, Required. Resource name of the message to be deleted, in the form "spaces/*/messages/*" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4 (required) + x__xgafv: string, V1 error format. + Allowed values + 1 - v1 error format + 2 - v2 error format + +Returns: + An object of the form: + + { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +}++get(name, x__xgafv=None)
+Returns a message. + +Args: + name: string, Required. Resource name of the message to be retrieved, in the form "spaces/*/messages/*". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4 (required) + x__xgafv: string, V1 error format. + Allowed values + 1 - v1 error format + 2 - v2 error format + +Returns: + An object of the form: + + { # A message in Hangouts Chat. + "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. }, }, - "topLabel": "A String", # The text of the top label. Formatted text supported. - }, - "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. - "text": "A String", - }, + ], }, ], }, - ], + }, }, - ], - "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. - "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). - "name": "A String", - "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. - "sender": { # A user in Google Chat. # The user who created the message. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. - "commandId": "A String", # The id of the slash command invoked. - }, - "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. - "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. - "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs - "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. - "threaded": True or False, # Whether the messages are threaded in this space. - "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. - }, - "text": "A String", # Plain-text body of the message. - "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. - "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 - }, -} - - threadKey: string, Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message. - x__xgafv: string, V1 error format. - Allowed values - 1 - v1 error format - 2 - v2 error format - -Returns: - An object of the form: - - { # A message in Hangouts Chat. - "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -598,288 +2445,541 @@Method Details
-- -delete(name, x__xgafv=None)
-Deletes a message. - -Args: - name: string, Required. Resource name of the message to be deleted, in the form "spaces/*/messages/*" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4 (required) - x__xgafv: string, V1 error format. - Allowed values - 1 - v1 error format - 2 - v2 error format - -Returns: - An object of the form: - - { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. -}--- -get(name, x__xgafv=None)
-Returns a message. +update(name, body=None, updateMask=None, x__xgafv=None)
+Updates a message. Args: - name: string, Required. Resource name of the message to be retrieved, in the form "spaces/*/messages/*". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4 (required) - x__xgafv: string, V1 error format. - Allowed values - 1 - v1 error format - 2 - v2 error format - -Returns: - An object of the form: + name: string, A parameter (required) + body: object, The request body. + The object takes the form of: - { # A message in Hangouts Chat. +{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. - "type": "A String", # The type of bot response. - "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) - }, - "annotations": [ # Output only. Annotations associated with the text in this message. - { # Annotations associated with the plain-text body of the message. Example plain-text message body: ``` Hello @FooBot how are you!" ``` The corresponding annotations metadata: ``` "annotations":[{ "type":"USER_MENTION", "startIndex":6, "length":7, "userMention": { "user": { "name":"users/107946847022116401880", "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" }, "type":"MENTION" } }] ``` - "length": 42, # Length of the substring in the plain-text message body this annotation corresponds to. - "slashCommand": { # Annotation metadata for slash commands (/). # The metadata for a slash command. - "bot": { # A user in Google Chat. # The bot whose command was invoked. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - "commandId": "A String", # The command id of the invoked slash command. - "commandName": "A String", # The name of the invoked slash command. - "triggersDialog": True or False, # Indicating whether the slash command is for a dialog. - "type": "A String", # The type of slash command. - }, - "startIndex": 42, # Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to. - "type": "A String", # The type of this annotation. - "userMention": { # Annotation metadata for user mentions (@). # The metadata of user mention. - "type": "A String", # The type of user mention. - "user": { # A user in Google Chat. # The user mentioned. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - }, - }, - ], - "argumentText": "A String", # Plain-text body of the message with all bot mentions stripped out. - "attachment": [ # User uploaded attachment. - { # An attachment in Hangouts Chat. - "attachmentDataRef": { # A reference to the data of an attachment. # A reference to the attachment data. This is used with the media API to download the attachment data. - "resourceName": "A String", # The resource name of the attachment data. This is used with the media API to download the attachment data. - }, - "contentName": "A String", # The original file name for the content, not the full path. - "contentType": "A String", # The content type (MIME type) of the file. - "downloadUri": "A String", # Output only. The download URL which should be used to allow a human user to download the attachment. Bots should not use this URL to download attachment content. - "driveDataRef": { # A reference to the data of a drive attachment. # A reference to the drive attachment. This is used with the Drive API. - "driveFileId": "A String", # The id for the drive file, for use with the Drive API. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. }, - "name": "A String", # Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*". - "source": "A String", # The source of the attachment. - "thumbnailUri": "A String", # Output only. The thumbnail URL which should be used to preview the attachment to a human user. Bots should not use this URL to download attachment content. - }, - ], - "cards": [ # Rich, formatted and interactive cards that can be used to display UI elements such as: formatted texts, buttons, clickable images. Cards are normally displayed below the plain-text body of the message. - { # A card is a UI element that can contain UI widgets such as texts, images. - "cardActions": [ # The actions of this card. - { # A card action is the action associated with the card. For an invoice card, a typical action would be: delete invoice, email invoice or open the invoice in browser. - "actionLabel": "A String", # The label used to be displayed in the action menu item. - "onClick": { # An onclick action (e.g. open a link). # The onclick action for this action item. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - ], + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. }, }, - }, - ], - "header": { # The header of the card. A header usually contains a title and an image. - "imageStyle": "A String", # The image's type (e.g. square border or circular border). - "imageUrl": "A String", # The URL of the image in the card header. - "subtitle": "A String", # The subtitle of the card header. - "title": "A String", # The title must be specified. The header has a fixed height: if both a title and subtitle is specified, each will take up 1 line. If only the title is specified, it will take up both lines. - }, - "name": "A String", # Name of the card. - "sections": [ # Sections are separated by a line divider. - { # A section contains a collection of widgets that are rendered (vertically) in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties (e.g. float). - "header": "A String", # The header of the section, text formatted supported. - "widgets": [ # A section must contain at least 1 widget. - { # A widget is a UI element that presents texts, images, etc. - "buttons": [ # A list of buttons. Buttons is also oneof data and only one of these fields should be set. - { # A button. Can be a text button or an image button. - "imageButton": { # An image button with an onclick action. # A button with image and onclick action. - "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. - "iconUrl": "A String", # The icon specified by a URL. - "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. - }, - }, - ], - "image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget. - "aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image. - "imageUrl": "A String", # The URL of the image. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. - }, - ], - }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "title": "A String", # The text that displays in the grid header. }, - }, - }, - "keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget. - "bottomLabel": "A String", # The text of the bottom label. Formatted text supported. - "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. - "imageButton": { # An image button with an onclick action. # A button with image and onclick action. - "icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API. - "iconUrl": "A String", # The icon specified by a URL. - "name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. - }, - }, - }, - "textButton": { # A button with text and onclick action. # A button with text and onclick action. - "onClick": { # An onclick action (e.g. open a link). # The onclick action of the button. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", "parameters": [ # List of action parameters. { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. "key": "A String", # The name of the parameter for the action script. "value": "A String", # The value of the parameter. }, ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", "url": "A String", # The URL to open. }, }, - "text": "A String", # The text of the button. }, - }, - "content": "A String", # The text of the content. Formatted text supported and always required. - "contentMultiline": True or False, # If the content should be multiline. - "icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image. - "iconUrl": "A String", # The icon specified by a URL. - "onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable. - "action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified. - "actionMethodName": "A String", # The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired. - "parameters": [ # List of action parameters. - { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. - "key": "A String", # The name of the parameter for the action script. - "value": "A String", # The value of the parameter. + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. }, ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", }, - "openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified. - "url": "A String", # The URL to open. + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. }, }, - "topLabel": "A String", # The text of the top label. Formatted text supported. - }, - "textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget. - "text": "A String", - }, + ], }, ], }, - ], + }, }, - ], - "createTime": "A String", # Output only. The time at which the message was created in Hangouts Chat server. - "fallbackText": "A String", # A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications). - "name": "A String", - "previewText": "A String", # Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips. - "sender": { # A user in Google Chat. # The user who created the message. - "displayName": "A String", # The user's display name. - "domainId": "A String", # Obfuscated domain information. - "isAnonymous": True or False, # True when the user is deleted or the user's profile is not visible. - "name": "A String", # Resource name, in the format "users/*". - "type": "A String", # User type. - }, - "slashCommand": { # A Slash Command in Chat. # Slash command information, if applicable. - "commandId": "A String", # The id of the slash command invoked. - }, - "space": { # A room or DM in Hangouts Chat. # The space the message belongs to. - "displayName": "A String", # Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans. - "name": "A String", # Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs - "singleUserBotDm": True or False, # Whether the space is a DM between a bot and a single human. - "threaded": True or False, # Whether the messages are threaded in this space. - "type": "A String", # Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead. - }, - "text": "A String", # Plain-text body of the message. - "thread": { # A thread in Hangouts Chat. # The thread the message belongs to. - "name": "A String", # Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4 - }, -}--update(name, body=None, updateMask=None, x__xgafv=None)
-Updates a message. - -Args: - name: string, A parameter (required) - body: object, The request body. - The object takes the form of: - -{ # A message in Hangouts Chat. - "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, @@ -1128,6 +3228,531 @@Method Details
{ # A message in Hangouts Chat. "actionResponse": { # Parameters that a bot can use to configure how it's response is posted. # Input only. Parameters that a bot can use to configure how its response is posted. + "dialogAction": { # Contains dialog if present as well as the ActionStatus for the request sent from user. # This response is for Dialog related events and must be accompanied by ResponseType.Dialog + "actionStatus": { # ActionStatus represents status of a request from the bot developer's side. In specific, for each request a bot gets, the bot developer will set both fields below in relation to what the response status and message related to status should be. # Status for either invoke dialog or submit dialog requests. This will be used to display a status and message to user if needed. For example in case of an error or success. + "statusCode": "A String", # The status code. + "userFacingMessage": "A String", # This message will be the corresponding string to the above status_code. If unset, an appropriate generic message based on the status_code will be shown to the user. If this field is set then the message will be surfaced to the user for both successes and errors. + }, + "dialog": { # Wrapper around the card body of the dialog. # Dialog for the request. + "body": { # A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number. ``` { "header": { "title": "Heba Salam", "subtitle": "Software Engineer", "imageStyle": "ImageStyle.AVATAR", "imageUrl": "https://example.com/heba_salam.png", "imageAltText": "Avatar for Heba Salam" }, "sections" : [ { "header": "Contact Info", "widgets": [ { "decorated_text": { "icon": { "knownIcon": "EMAIL" }, "content": "heba.salam@example.com" } }, { "decoratedText": { "icon": { "knownIcon": "PERSON" }, "content": "Online" } }, { "decoratedText": { "icon": { "knownIcon": "PHONE" }, "content": "+1 (555) 555-1234" } }, { "buttons": [ { "textButton": { "text": "Share", }, "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "textButton": { "text": "Edit", }, "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ], "loadIndicator": "LoadIndicator.SPINNER" } } } ] } ], "collapsible": true, "uncollapsibleWidgetsCount": 3 } ], "cardActions": [ { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ], "name": "contact-card-K3wB6arF2H9L" } ``` # Body of the dialog, which will be rendered in a modal. NOTE: The following fields within the objects are not supported: google.apps.card.v1.Widget.date_time_picker google.apps.card.v1.DecoratedText.SwitchControl.on_change_action google.apps.card.v1.TextInput.on_change_action google.apps.card.v1.SelectionInput.on_change_action google.apps.card.v1.DateTimePicker.on_change_action Setting the fields above will have no effect on the dialog. + "cardActions": [ # The actions of this card. They are added to a card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: ``` "card_actions": [ { "actionLabel": "Setting", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] ``` + { # A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. + "actionLabel": "A String", # The label that displays as the action menu item. + "onClick": { # The onclick action for this action item. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + ], + "displayStyle": "A String", # The display style for peekCardHeader. + "fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card. + "primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + }, + "header": { # The header of the card. A header usually contains a title and an image. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "name": "A String", # Name of the card, which is used as a identifier for the card in card navigation. + "peekCardHeader": { # When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. + "imageAltText": "A String", # The alternative text of this image which is used for accessibility. + "imageType": "A String", # The image's type. + "imageUrl": "A String", # The URL of the image in the card header. + "subtitle": "A String", # The subtitle of the card header. + "title": "A String", # The title of the card header. The title must be specified. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. + }, + "sections": [ # Sections are separated by a line divider. + { # A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float. + "collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given. + "header": "A String", # The header of the section. Formatted text is supported. + "uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. For example, when a section contains five widgets and the `numUncollapsibleWidget` is set to `2`, the first two widgets are always shown and the last three are collapsed as default. The `numUncollapsibleWidget` is taken into account only when collapsible is set to `true`. + "widgets": [ # A section must contain at least 1 widget. + { # A widget is a UI element that presents texts, images, etc. + "buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ``` + "buttons": [ + { # A button. Can be a text button or an image button. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + ], + }, + "dateTimePicker": { # The widget that lets users to specify a date and time. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ``` + "label": "A String", # The label for the field that displays to the user. + "name": "A String", # The name of the text input that's used in formInput, and uniquely identifies this input. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "timezoneOffsetDate": 42, # The number representing the time zone offset from UTC, in minutes. If set, the `value_ms_epoch` is displayed in the specified time zone. If not set, it uses the user's time zone setting on the client side. + "type": "A String", # The type of the date/time picker. + "valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am. + }, + "decoratedText": { # A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "heba.salam@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_heba_salam", "selected": false, "controlType": "ControlType.CHECKBOX" } } ``` + "bottomLabel": "A String", # The formatted text label that shows below the main text. + "button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action. + "altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead. + "color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # If set, the button is filled with a solid background. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "disabled": True or False, # If true, the button is displayed in a disabled state and doesn't respond to user actions. + "icon": { # The icon image. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # The action to perform when the button is clicked. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "text": "A String", # The text of the button. + }, + "endIcon": { # An icon displayed after the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "icon": { # Deprecated in favor of start_icon. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "onClick": { # Only the top and bottom label and content region are clickable. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "startIcon": { # The icon displayed in front of the text. + "altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one. + "iconUrl": "A String", # The icon specified by a URL. + "imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon. + "knownIcon": "A String", # The icon specified by the string name of a list of known icons + }, + "switchControl": { # A switch widget can be clicked to change its state or trigger an action. + "controlType": "A String", # The control type, either switch or checkbox. + "name": "A String", # The name of the switch widget that's used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "selected": True or False, # If the switch is selected. + "value": "A String", # The value is what is passed back in the callback. + }, + "text": "A String", # Required. The main widget formatted text. See Text formatting for details. + "topLabel": "A String", # The formatted text label that shows above the main text. + "wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated. + }, + "divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ``` + }, + "grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "items": [ "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" ], "onClick": { "openLink": { "url":"https://www.example.com" } } } ``` + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "columnCount": 42, # The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). + "items": [ # The items to display in the grid. + { # Represents a single item in the grid layout. + "id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. + "image": { # The image that displays in the grid item. + "altText": "A String", # The accessibility label for the image. + "borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image. + "cornerRadius": 42, # The corner radius for the border. + "strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`. + "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). + "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. + "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. + "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. + }, + "type": "A String", # The border type. + }, + "cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image. + "aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + "type": "A String", # The crop type. + }, + "imageUri": "A String", # The image URL. + }, + "layout": "A String", # The layout to use for the grid item. + "subtitle": "A String", # The grid item's subtitle. + "textAlignment": "A String", # The horizontal alignment of the grid item's text. + "title": "A String", # The grid item's title. + }, + ], + "onClick": { # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + "title": "A String", # The text that displays in the grid header. + }, + "horizontalAlignment": "A String", # The horizontal alignment of this widget. + "image": { # An image that is specified by a URL and can have an onClick action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/heba_salam.png" "altText": "Avatar for Heba Salam" } ``` + "altText": "A String", # The alternative text of this image, used for accessibility. + "imageUrl": "A String", # An image URL. + "onClick": { + "action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this onClick. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified. + "openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "openLink": { # If specified, this onClick triggers an open link action. + "onClose": "A String", + "openAs": "A String", + "url": "A String", # The URL to open. + }, + }, + }, + "selectionInput": { # A widget that creates a UI item (for example, a drop-down list) with options for users to select. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ``` + "items": [ + { # The item in the switch control. A radio button, at most one of the items is selected. + "selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored. + "text": "A String", # The text to be displayed. + "value": "A String", # The value associated with this item. The client should use this as a form input value. + }, + ], + "label": "A String", # The label displayed ahead of the switch control. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", + }, + "textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ``` + "autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "hintText": "A String", # The hint text. + "initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input. + "items": [ # A list of suggestions items which will be used in are used in autocomplete. + { # A suggestion item. Only supports text for now. + "text": "A String", + }, + ], + }, + "label": "A String", # At least one of label and hintText must be specified. + "name": "A String", # The name of the text input which is used in formInput. + "onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function. + "function": "A String", # Apps Script function to invoke when the containing element is clicked/activated. + "loadIndicator": "A String", + "parameters": [ # List of action parameters. + { # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. + "key": "A String", # The name of the parameter for the action script. + "value": "A String", # The value of the parameter. + }, + ], + "persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. + }, + "type": "A String", # The style of the text, for example, a single line or multiple lines. + "value": "A String", # The default value when there is no input from the user. + }, + "textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](workspace/add-ons/concepts/widgets#text_formatting") for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ``` + "text": "A String", # The text that's shown in the widget. + }, + }, + ], + }, + ], + }, + }, + }, "type": "A String", # The type of bot response. "url": "A String", # URL for users to auth or config. (Only for REQUEST_CONFIG response types.) }, diff --git a/docs/dyn/cloudasset_v1.v1.html b/docs/dyn/cloudasset_v1.v1.html index a3a7f9bdfbf..3f1a4699da4 100644 --- a/docs/dyn/cloudasset_v1.v1.html +++ b/docs/dyn/cloudasset_v1.v1.html @@ -79,7 +79,7 @@Instance Methods
Analyzes IAM policies to answer which identities have what accesses on which resources.
-
analyzeIamPolicyLongrunning(scope, body=None, x__xgafv=None)
Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the request to help callers to map responses to requests.
+Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.
analyzeMove(resource, destinationParent=None, view=None, x__xgafv=None)
Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.
@@ -348,7 +348,7 @@Method Details
analyzeIamPolicyLongrunning(scope, body=None, x__xgafv=None)
-Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the request to help callers to map responses to requests. +Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation. Args: scope: string, Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization id, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project id, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects). (required) diff --git a/docs/dyn/cloudbuild_v1.projects.builds.html b/docs/dyn/cloudbuild_v1.projects.builds.html index 6ed4772bc81..ffa4e8037ae 100644 --- a/docs/dyn/cloudbuild_v1.projects.builds.html +++ b/docs/dyn/cloudbuild_v1.projects.builds.html @@ -154,6 +154,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -392,6 +396,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -661,6 +669,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -905,6 +917,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. diff --git a/docs/dyn/cloudbuild_v1.projects.locations.builds.html b/docs/dyn/cloudbuild_v1.projects.locations.builds.html index fb4b5828a8f..3e2fd20eb3d 100644 --- a/docs/dyn/cloudbuild_v1.projects.locations.builds.html +++ b/docs/dyn/cloudbuild_v1.projects.locations.builds.html @@ -153,6 +153,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -391,6 +395,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -660,6 +668,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -904,6 +916,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. diff --git a/docs/dyn/cloudbuild_v1.projects.locations.triggers.html b/docs/dyn/cloudbuild_v1.projects.locations.triggers.html index faec0611a5b..5c2898e074f 100644 --- a/docs/dyn/cloudbuild_v1.projects.locations.triggers.html +++ b/docs/dyn/cloudbuild_v1.projects.locations.triggers.html @@ -78,7 +78,7 @@Instance Methods
close()
Close httplib2 connections.
-
+create(parent, body=None, projectId=None, x__xgafv=None)
create(parent, body, projectId=None, x__xgafv=None)
Creates a new `BuildTrigger`. This API is experimental.
@@ -93,7 +93,7 @@
delete(name, projectId=None, triggerId=None, x__xgafv=None)
Instance Methods
list_next(previous_request, previous_response)
Retrieves the next page of results.
-
+patch(resourceName, body=None, projectId=None, triggerId=None, x__xgafv=None)
patch(resourceName, body, projectId=None, triggerId=None, x__xgafv=None)
Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.
@@ -108,7 +108,7 @@
run(name, body=None, x__xgafv=None)
Method Details
-create(parent, body=None, projectId=None, x__xgafv=None)
+create(parent, body, projectId=None, x__xgafv=None)
Creates a new `BuildTrigger`. This API is experimental. Args: @@ -152,6 +152,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -375,6 +379,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -444,6 +453,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -667,6 +680,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -764,6 +782,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -987,6 +1009,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1068,6 +1095,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1291,6 +1322,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1333,7 +1369,7 @@Method Details
-patch(resourceName, body=None, projectId=None, triggerId=None, x__xgafv=None)
+patch(resourceName, body, projectId=None, triggerId=None, x__xgafv=None)
Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental. Args: @@ -1377,6 +1413,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1600,6 +1640,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1670,6 +1715,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1893,6 +1942,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, diff --git a/docs/dyn/cloudbuild_v1.projects.locations.workerPools.html b/docs/dyn/cloudbuild_v1.projects.locations.workerPools.html index b154dfe20da..525a4acf6a5 100644 --- a/docs/dyn/cloudbuild_v1.projects.locations.workerPools.html +++ b/docs/dyn/cloudbuild_v1.projects.locations.workerPools.html @@ -247,7 +247,7 @@Method Details
Lists `WorkerPool`s. Args: - parent: string, Required. The parent of the collection of `WorkerPools`. Format: `projects/{project}/locations/location`. (required) + parent: string, Required. The parent of the collection of `WorkerPools`. Format: `projects/{project}/locations/{location}`. (required) pageSize: integer, The maximum number of `WorkerPool`s to return. The service may return fewer than this value. If omitted, the server will use a sensible default. pageToken: string, A page token, received from a previous `ListWorkerPools` call. Provide this to retrieve the subsequent page. x__xgafv: string, V1 error format. diff --git a/docs/dyn/cloudbuild_v1.projects.triggers.html b/docs/dyn/cloudbuild_v1.projects.triggers.html index 0ae72e4ccd9..14c7e600afd 100644 --- a/docs/dyn/cloudbuild_v1.projects.triggers.html +++ b/docs/dyn/cloudbuild_v1.projects.triggers.html @@ -78,7 +78,7 @@Instance Methods
close()
Close httplib2 connections.
-
+create(projectId, body=None, parent=None, x__xgafv=None)
create(projectId, body, parent=None, x__xgafv=None)
Creates a new `BuildTrigger`. This API is experimental.
@@ -93,7 +93,7 @@
delete(projectId, triggerId, name=None, x__xgafv=None)
Instance Methods
list_next(previous_request, previous_response)
Retrieves the next page of results.
-
+patch(projectId, triggerId, body=None, x__xgafv=None)
patch(projectId, triggerId, body, x__xgafv=None)
Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.
@@ -108,7 +108,7 @@
run(projectId, triggerId, body=None, name=None, x__xgafv=None)
Method Details
-create(projectId, body=None, parent=None, x__xgafv=None)
+create(projectId, body, parent=None, x__xgafv=None)
Creates a new `BuildTrigger`. This API is experimental. Args: @@ -152,6 +152,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -375,6 +379,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -444,6 +453,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -667,6 +680,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -764,6 +782,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -987,6 +1009,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1068,6 +1095,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1291,6 +1322,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1333,7 +1369,7 @@Method Details
-patch(projectId, triggerId, body=None, x__xgafv=None)
+patch(projectId, triggerId, body, x__xgafv=None)
Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental. Args: @@ -1378,6 +1414,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1601,6 +1641,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, @@ -1669,6 +1714,10 @@Method Details
}, "buildTriggerId": "A String", # Output only. The ID of the `BuildTrigger` that triggered this build, if it was triggered automatically. "createTime": "A String", # Output only. Time at which the request to create the build was received. + "failureInfo": { # A fatal problem encountered during the execution of the build. # Output only. Contains information about the build when status=FAILURE. + "detail": "A String", # Explains the failure issue in more detail using hard-coded text. + "type": "A String", # The name of the failure. + }, "finishTime": "A String", # Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution. "id": "A String", # Output only. Unique identifier of the build. "images": [ # A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the `Build` resource's results field. If any of the images fail to be pushed, the build status is marked `FAILURE`. @@ -1892,6 +1941,11 @@Method Details
"topic": "A String", # The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. }, "resourceName": "A String", # The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service. + "sourceToBuild": { # GitRepoSource describes a repo and ref of a code repository. # The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. + "ref": "A String", # The branch or tag to use. Must start with "refs/" (required). + "repoType": "A String", # See RepoType below. + "uri": "A String", # The URI of the repo (required). + }, "substitutions": { # Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`. "a_key": "A String", }, diff --git a/docs/dyn/cloudfunctions_v1.projects.locations.functions.html b/docs/dyn/cloudfunctions_v1.projects.locations.functions.html index 5f0964a7a37..3c7682aeb97 100644 --- a/docs/dyn/cloudfunctions_v1.projects.locations.functions.html +++ b/docs/dyn/cloudfunctions_v1.projects.locations.functions.html @@ -156,7 +156,7 @@Method Details
body: object, The request body. The object takes the form of: -{ # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. +{ # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. Next tag: 35 "availableMemoryMb": 42, # The amount of memory in MB available for a function. Defaults to 256MB. "buildEnvironmentVariables": { # Build environment variables that shall be available during build time. "a_key": "A String", @@ -192,7 +192,7 @@Method Details
"secretEnvironmentVariables": [ # Secret environment variables configuration. { # Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable. Secret value is not a part of the configuration. Secret values are only fetched when a new clone starts. "key": "A String", # Name of the environment variable. - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "version": "A String", # Version of the secret (version number or the string 'latest'). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new clones start. }, @@ -200,7 +200,7 @@Method Details
"secretVolumes": [ # Secret volumes configuration. { # Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container. Secret value is not a part of the configuration. Every filesystem read operation performs a lookup in secret manager to retrieve the secret value. "mountPath": "A String", # The path within the container to mount the secret volume. For example, setting the mount_path as `/etc/secrets` would mount the secret value files under the `/etc/secrets` directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount paths: /etc/secrets Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "versions": [ # List of secret versions to mount for this secret. If empty, the `latest` version of the secret will be made available in a file named after the secret under the mount point. { # Configuration for a single version. @@ -355,7 +355,7 @@Method Details
Returns: An object of the form: - { # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. + { # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. Next tag: 35 "availableMemoryMb": 42, # The amount of memory in MB available for a function. Defaults to 256MB. "buildEnvironmentVariables": { # Build environment variables that shall be available during build time. "a_key": "A String", @@ -391,7 +391,7 @@Method Details
"secretEnvironmentVariables": [ # Secret environment variables configuration. { # Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable. Secret value is not a part of the configuration. Secret values are only fetched when a new clone starts. "key": "A String", # Name of the environment variable. - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "version": "A String", # Version of the secret (version number or the string 'latest'). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new clones start. }, @@ -399,7 +399,7 @@Method Details
"secretVolumes": [ # Secret volumes configuration. { # Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container. Secret value is not a part of the configuration. Every filesystem read operation performs a lookup in secret manager to retrieve the secret value. "mountPath": "A String", # The path within the container to mount the secret volume. For example, setting the mount_path as `/etc/secrets` would mount the secret value files under the `/etc/secrets` directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount paths: /etc/secrets Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "versions": [ # List of secret versions to mount for this secret. If empty, the `latest` version of the secret will be made available in a file named after the secret under the mount point. { # Configuration for a single version. @@ -492,7 +492,7 @@Method Details
{ # Response for the `ListFunctions` method. "functions": [ # The functions that match the request. - { # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. + { # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. Next tag: 35 "availableMemoryMb": 42, # The amount of memory in MB available for a function. Defaults to 256MB. "buildEnvironmentVariables": { # Build environment variables that shall be available during build time. "a_key": "A String", @@ -528,7 +528,7 @@Method Details
"secretEnvironmentVariables": [ # Secret environment variables configuration. { # Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable. Secret value is not a part of the configuration. Secret values are only fetched when a new clone starts. "key": "A String", # Name of the environment variable. - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "version": "A String", # Version of the secret (version number or the string 'latest'). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new clones start. }, @@ -536,7 +536,7 @@Method Details
"secretVolumes": [ # Secret volumes configuration. { # Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container. Secret value is not a part of the configuration. Every filesystem read operation performs a lookup in secret manager to retrieve the secret value. "mountPath": "A String", # The path within the container to mount the secret volume. For example, setting the mount_path as `/etc/secrets` would mount the secret value files under the `/etc/secrets` directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount paths: /etc/secrets Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "versions": [ # List of secret versions to mount for this secret. If empty, the `latest` version of the secret will be made available in a file named after the secret under the mount point. { # Configuration for a single version. @@ -592,7 +592,7 @@Method Details
body: object, The request body. The object takes the form of: -{ # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. +{ # Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations. Next tag: 35 "availableMemoryMb": 42, # The amount of memory in MB available for a function. Defaults to 256MB. "buildEnvironmentVariables": { # Build environment variables that shall be available during build time. "a_key": "A String", @@ -628,7 +628,7 @@Method Details
"secretEnvironmentVariables": [ # Secret environment variables configuration. { # Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable. Secret value is not a part of the configuration. Secret values are only fetched when a new clone starts. "key": "A String", # Name of the environment variable. - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "version": "A String", # Version of the secret (version number or the string 'latest'). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new clones start. }, @@ -636,7 +636,7 @@Method Details
"secretVolumes": [ # Secret volumes configuration. { # Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container. Secret value is not a part of the configuration. Every filesystem read operation performs a lookup in secret manager to retrieve the secret value. "mountPath": "A String", # The path within the container to mount the secret volume. For example, setting the mount_path as `/etc/secrets` would mount the secret value files under the `/etc/secrets` directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount paths: /etc/secrets Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - "projectId": "A String", # Project whose secret manager data is being referenced. Cross project secrets are not supported. + "projectId": "A String", # Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function. "secret": "A String", # Name of the secret in secret manager (not the full resource name). "versions": [ # List of secret versions to mount for this secret. If empty, the `latest` version of the secret will be made available in a file named after the secret under the mount point. { # Configuration for a single version. diff --git a/docs/dyn/content_v2_1.accounts.html b/docs/dyn/content_v2_1.accounts.html index 86b8370ffe6..cee61c6b43e 100644 --- a/docs/dyn/content_v2_1.accounts.html +++ b/docs/dyn/content_v2_1.accounts.html @@ -125,12 +125,18 @@Instance Methods
listlinks_next(previous_request, previous_response)
Retrieves the next page of results.
++
+requestphoneverification(merchantId, accountId, body=None, x__xgafv=None)
Request verification code to start phone verification.
update(merchantId, accountId, body=None, x__xgafv=None)
Updates a Merchant Center account. Any fields that are not provided are deleted from the resource.
updatelabels(merchantId, accountId, body=None, x__xgafv=None)
Updates labels that are assigned to the Merchant Center account by CSS user.
++
+verifyphonenumber(merchantId, accountId, body=None, x__xgafv=None)
Validates verification code to verify phone number for the account.
Method Details
+authinfo(x__xgafv=None)
@@ -771,6 +777,36 @@Method Details
++requestphoneverification(merchantId, accountId, body=None, x__xgafv=None)
+Request verification code to start phone verification. + +Args: + merchantId: string, Required. The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and accountId must be the ID of a sub-account of this account. (required) + accountId: string, Required. The ID of the account. (required) + body: object, The request body. + The object takes the form of: + +{ # Request message for the RequestPhoneVerification method. + "languageCode": "A String", # Language code [IETF BCP 47 syntax](https://tools.ietf.org/html/bcp47) (for example, en-US). Language code is used to provide localized `SMS` and `PHONE_CALL`. Default language used is en-US if not provided. + "phoneNumber": "A String", # Phone number to be verified. + "phoneRegionCode": "A String", # Required. Two letter country code for the phone number, for example `CA` for Canadian numbers. See the [ISO 3166-1 alpha-2](https://wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) officially assigned codes. + "phoneVerificationMethod": "A String", # Verification method to receive verification code. +} + + x__xgafv: string, V1 error format. + Allowed values + 1 - v1 error format + 2 - v2 error format + +Returns: + An object of the form: + + { # Response message for the RequestPhoneVerification method. + "verificationId": "A String", # The verification ID to use in subsequent calls to `verifyphonenumber`. +}++update(merchantId, accountId, body=None, x__xgafv=None)
Updates a Merchant Center account. Any fields that are not provided are deleted from the resource. @@ -935,4 +971,33 @@Method Details
}++verifyphonenumber(merchantId, accountId, body=None, x__xgafv=None)
+Validates verification code to verify phone number for the account. + +Args: + merchantId: string, Required. The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and accountId must be the ID of a sub-account of this account. (required) + accountId: string, Required. The ID of the account. (required) + body: object, The request body. + The object takes the form of: + +{ # Request message for the VerifyPhoneNumber method. + "phoneVerificationMethod": "A String", # Verification method used to receive verification code. + "verificationCode": "A String", # The verification code that was sent to the phone number for validation. + "verificationId": "A String", # The verification ID returned by `requestphoneverification`. +} + + x__xgafv: string, V1 error format. + Allowed values + 1 - v1 error format + 2 - v2 error format + +Returns: + An object of the form: + + { # Response message for the VerifyPhoneNumber method. + "verifiedPhoneNumber": "A String", # Verified phone number if verification is successful. +}+