AdMob API v1 20191210

Basic account info, mediation and network report available. See https://developers.google.com/admob/api/release-notes for more details.

PiperOrigin-RevId: 285894502
This commit is contained in:
Google APIs 2019-12-16 18:47:23 -08:00 committed by Copybara-Service
parent 41fc140373
commit fe1962e499
7 changed files with 1380 additions and 0 deletions

View File

@ -0,0 +1 @@
exports_files(glob(["*.yaml"]))

View File

@ -0,0 +1,36 @@
type: google.api.Service
config_version: 3
name: admob.googleapis.com
title: AdMob API
apis:
- name: google.ads.admob.v1.AdMobApi
documentation:
summary: The Google AdMob API lets you programmatically get reports on earnings.
authentication:
rules:
- selector: 'google.ads.admob.v1.AdMobApi.GetPublisherAccount'
oauth:
canonical_scopes: https://www.googleapis.com/auth/admob.report
- selector: 'google.ads.admob.v1.AdMobApi.ListPublisherAccounts'
oauth:
canonical_scopes: https://www.googleapis.com/auth/admob.report
- selector: 'google.ads.admob.v1.AdMobApi.GenerateMediationReport'
oauth:
canonical_scopes: https://www.googleapis.com/auth/admob.report
- selector: 'google.ads.admob.v1.AdMobApi.GenerateNetworkReport'
oauth:
canonical_scopes: https://www.googleapis.com/auth/admob.report
backend:
rules:
- selector: 'google.ads.admob.v1.AdMobApi.GetPublisherAccount'
deadline: 5.0
- selector: 'google.ads.admob.v1.AdMobApi.ListPublisherAccounts'
deadline: 10.0
- selector: 'google.ads.admob.v1.AdMobApi.GenerateMediationReport'
deadline: 60.0
- selector: 'google.ads.admob.v1.AdMobApi.GenerateNetworkReport'
deadline: 60.0

View File

@ -0,0 +1,34 @@
common:
api_name: admob
api_version: v1
organization_name: ads
proto_deps:
- name: google-common-protos
src_proto_paths:
- .
service_yaml: admob_v1.yaml
gapic_yaml: v1/admob_gapic.yaml
artifacts:
- name: gapic_config
type: GAPIC_CONFIG
- name: java_gapic
type: GAPIC
language: JAVA
- name: python_gapic
type: GAPIC
language: PYTHON
- name: nodejs_gapic
type: GAPIC
language: NODEJS
- name: php_gapic
type: GAPIC
language: PHP
- name: go_gapic
type: GAPIC
language: GO
- name: ruby_gapic
type: GAPIC
language: RUBY
- name: csharp_gapic
type: GAPIC
language: CSHARP

View File

@ -0,0 +1,371 @@
# This file was automatically generated.
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "admob_proto",
srcs = [
"admob_api.proto",
"admob_resources.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/type:date_proto",
],
)
proto_library_with_info(
name = "admob_proto_with_info",
deps = [
":admob_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_grpc_library",
"java_gapic_library",
"java_gapic_assembly_gradle_pkg",
"java_proto_library",
"java_gapic_test",
)
java_proto_library(
name = "admob_java_proto",
deps = [":admob_proto"],
)
java_grpc_library(
name = "admob_java_grpc",
srcs = [":admob_proto"],
deps = [":admob_java_proto"],
)
java_gapic_library(
name = "admob_java_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
test_deps = [":admob_java_grpc"],
deps = [":admob_java_proto"],
)
java_gapic_test(
name = "admob_java_gapic_test_suite",
test_classes = [
"com.google.ads.admob.v1.AdMobServiceClientTest",
],
runtime_deps = [":admob_java_gapic_test"],
)
# Opensource Packages
java_gapic_assembly_gradle_pkg(
name = "google-cloud-admob-v1-java",
deps = [
":admob_java_gapic",
":admob_java_grpc",
":admob_java_proto",
":admob_proto",
],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_gapic_assembly_pkg",
"go_gapic_library",
"go_proto_library",
"go_test",
)
go_proto_library(
name = "admob_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/ads/admob/v1",
protos = [":admob_proto"],
deps = [
"//google/api:annotations_go_proto",
"//google/type:date_go_proto",
]
)
go_gapic_library(
name = "admob_go_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
importpath = "cloud.google.com/go/ads/admob/apiv1",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [
":admob_go_proto",
],
)
go_test(
name = "admob_go_gapic_test",
srcs = [":admob_go_gapic_srcjar_test"],
embed = [":admob_go_gapic"],
importpath = "cloud.google.com/go/ads/admob/apiv1",
)
# Open Source Packages
go_gapic_assembly_pkg(
name = "gapi-cloud-admob-v1-go",
deps = [
":admob_go_gapic",
":admob_go_gapic_srcjar-smoke-test.srcjar",
":admob_go_gapic_srcjar-test.srcjar",
":admob_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "admob_moved_proto",
srcs = [":admob_proto"],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/type:date_proto",
],
)
py_proto_library(
name = "admob_py_proto",
plugin = "@protoc_docs_plugin//:docs_plugin",
deps = [":admob_moved_proto"],
)
py_grpc_library(
name = "admob_py_grpc",
srcs = [":admob_moved_proto"],
deps = [":admob_py_proto"],
)
py_gapic_library(
name = "admob_py_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [
":admob_py_grpc",
":admob_py_proto",
],
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "admob-v1-py",
deps = [
":admob_py_gapic",
":admob_py_grpc",
":admob_py_proto",
],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "admob_php_proto",
deps = [":admob_proto"],
)
php_grpc_library(
name = "admob_php_grpc",
srcs = [":admob_proto"],
deps = [":admob_php_proto"],
)
php_gapic_library(
name = "admob_php_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [
":admob_php_grpc",
":admob_php_proto",
],
)
# Open Source Packages
php_gapic_assembly_pkg(
name = "google-cloud-admob-v1-php",
deps = [
":admob_php_gapic",
":admob_php_grpc",
":admob_php_proto",
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "admob_nodejs_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [],
)
nodejs_gapic_assembly_pkg(
name = "admob-v1-nodejs",
deps = [
":admob_nodejs_gapic",
":admob_proto",
],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_gapic_assembly_pkg",
"ruby_gapic_library",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "admob_ruby_proto",
deps = [":admob_proto"],
)
ruby_grpc_library(
name = "admob_ruby_grpc",
srcs = [":admob_proto"],
deps = [":admob_ruby_proto"],
)
ruby_gapic_library(
name = "admob_ruby_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [
":admob_ruby_grpc",
":admob_ruby_proto",
],
)
# Open Source Packages
ruby_gapic_assembly_pkg(
name = "google-cloud-admob-v1-ruby",
deps = [
":admob_ruby_gapic",
":admob_ruby_grpc",
":admob_ruby_proto",
],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
"csharp_gapic_library",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "admob_csharp_proto",
deps = [":admob_proto"],
)
csharp_grpc_library(
name = "admob_csharp_grpc",
srcs = [":admob_proto"],
deps = [":admob_csharp_proto"],
)
csharp_gapic_library(
name = "admob_csharp_gapic",
src = ":admob_proto_with_info",
gapic_yaml = "admob_gapic.yaml",
package = "google.ads.admob.v1",
service_yaml = "//google/ads/admob:admob_v1.yaml",
deps = [
":admob_csharp_grpc",
":admob_csharp_proto",
],
)
# Open Source Packages
csharp_gapic_assembly_pkg(
name = "google-cloud-admob-v1-csharp",
deps = [
":admob_csharp_gapic",
":admob_csharp_grpc",
":admob_csharp_proto",
],
)
##############################################################################
# C++
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_grpc_library",
"cc_proto_library",
)
cc_proto_library(
name = "admob_cc_proto",
deps = [":admob_proto"],
)
cc_grpc_library(
name = "admobcc_grpc",
srcs = [":admob_proto"],
grpc_only = True,
deps = [":admob_cc_proto"],
)

View File

@ -0,0 +1,221 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.ads.admob.v1;
import "google/ads/admob/v1/admob_resources.proto";
import "google/api/annotations.proto";
import "google/api/client.proto";
option go_package = "google.golang.org/genproto/googleapis/ads/admob/v1;admob";
option java_outer_classname = "AdMobApiProto";
option java_package = "com.google.ads.admob.v1";
// The AdMob API allows AdMob publishers to access their account settings and
// generate reports.
service AdMobApi {
option (google.api.default_host) = "admob.googleapis.com";
// Gets information about the specified AdMob publisher account.
rpc GetPublisherAccount(GetPublisherAccountRequest)
returns (PublisherAccount) {
option (google.api.http) = {
get: "/v1/{name=accounts/*}"
};
}
// Lists the AdMob publisher account accessible with the client credential.
// Currently, all credentials have access to at most one AdMob account.
rpc ListPublisherAccounts(ListPublisherAccountsRequest)
returns (ListPublisherAccountsResponse) {
option (google.api.http) = {
get: "/v1/accounts"
};
}
// Generates an AdMob Network report based on the provided report
// specification.
rpc GenerateNetworkReport(GenerateNetworkReportRequest)
returns (stream GenerateNetworkReportResponse) {
option (google.api.http) = {
post: "/v1/{parent=accounts/*}/networkReport:generate"
body: "*"
};
}
// Generates an AdMob Mediation report based on the provided report
// specification.
rpc GenerateMediationReport(GenerateMediationReportRequest)
returns (stream GenerateMediationReportResponse) {
option (google.api.http) = {
post: "/v1/{parent=accounts/*}/mediationReport:generate"
body: "*"
};
}
}
// Request to retrieve the specified publisher account.
message GetPublisherAccountRequest {
// Resource name of the publisher account to retrieve.
// Example: accounts/pub-9876543210987654
string name = 1;
}
// Request to retrieve the AdMob publisher account accessible with the client
// credential. Currently all credentials have access to at most 1 account.
message ListPublisherAccountsRequest {
// Maximum number of accounts to return.
int32 page_size = 1;
// The value returned by the last `ListPublisherAccountsResponse`; indicates
// that this is a continuation of a prior `ListPublisherAccounts` call, and
// that the system should return the next page of data.
string page_token = 2;
}
// Response for the publisher account list request.
message ListPublisherAccountsResponse {
// Publisher that the client credentials can access.
repeated PublisherAccount account = 1;
// If not empty, indicates that there might be more accounts for the request;
// you must pass this value in a new `ListPublisherAccountsRequest`.
string next_page_token = 2;
}
// Request to generate an AdMob Mediation report.
message GenerateMediationReportRequest {
// Resource name of the account to generate the report for.
// Example: accounts/pub-9876543210987654
string parent = 1;
// Network report specification.
MediationReportSpec report_spec = 2;
}
// The streaming response for the AdMob Mediation report where the first
// response contains the report header, then a stream of row responses, and
// finally a footer as the last response message.
//
// For example:
//
// [{
// "header": {
// "date_range": {
// "start_date": {"year": 2018, "month": 9, "day": 1},
// "end_date": {"year": 2018, "month": 9, "day": 30}
// }
// "localization_settings": {
// "currency_code": "USD",
// "language_code": "en-US"
// }
// }
// },
// {
// "row": {
// "dimension_values": {
// "DATE": {"value": "20180918"},
// "APP": {
// "value": "ca-app-pub-8123415297019784~1001342552",
// "display_label": "My app name!"
// }
// },
// "metric_values": {
// "ESTIMATED_EARNINGS": {"decimal_value": "1324746"}
// }
// }
// },
// {
// "footer": {"matching_row_count": 1}
// }]
message GenerateMediationReportResponse {
// Each stream response message contains one type of payload.
oneof payload {
// Report generation settings that describes the report contents, such as
// the report date range and localization settings.
ReportHeader header = 1;
// Actual report data.
ReportRow row = 2;
// Additional information about the generated report, such as warnings about
// the data.
ReportFooter footer = 3;
}
}
// Request to generate an AdMob Network report.
message GenerateNetworkReportRequest {
// Resource name of the account to generate the report for.
// Example: accounts/pub-9876543210987654
string parent = 1;
// Network report specification.
NetworkReportSpec report_spec = 2;
}
// The streaming response for the AdMob Network report where the first response
// contains the report header, then a stream of row responses, and finally a
// footer as the last response message.
//
// For example:
//
// [{
// "header": {
// "dateRange": {
// "startDate": {"year": 2018, "month": 9, "day": 1},
// "endDate": {"year": 2018, "month": 9, "day": 30}
// }
// "localizationSettings": {
// "currencyCode": "USD",
// "languageCode": "en-US"
// }
// }
// },
// {
// "row": {
// "dimensionValues": {
// "DATE": {"value": "20180918"},
// "APP": {
// "value": "ca-app-pub-8123415297019784~1001342552",
// displayLabel: "My app name!"
// }
// },
// "metricValues": {
// "ESTIMATED_EARNINGS": {"microsValue": 6500000}
// }
// }
// },
// ...
// {
// "footer": {"matchingRowCount": 5}
// }]
message GenerateNetworkReportResponse {
// Each stream response message contains one type of payload.
oneof payload {
// Report generation settings that describes the report contents, such as
// the report date range and localization settings.
ReportHeader header = 1;
// Actual report data.
ReportRow row = 2;
// Additional information about the generated report, such as warnings about
// the data.
ReportFooter footer = 3;
}
}

View File

@ -0,0 +1,150 @@
type: com.google.api.codegen.ConfigProto
config_schema_version: 1.0.0
# The settings of generated code in a specific language.
language_settings:
java:
package_name: com.google.cloud.ads.admob.v1
python:
package_name: google.cloud.ads.admob_v1.gapic
go:
package_name: cloud.google.com/go/ads/admob/apiv1
csharp:
package_name: Google.Ads.Admob.V1
ruby:
package_name: Google::Cloud::Ads::Admob::V1
php:
package_name: Google\Cloud\Ads\Admob\V1
nodejs:
package_name: admob.v1
# A list of API interface configurations.
interfaces:
# The fully qualified name of the API interface.
- name: google.ads.admob.v1.AdMobApi
# A list of resource collection configurations.
# Consists of a name_pattern and an entity_name.
# The name_pattern is a pattern to describe the names of the resources of this
# collection, using the platform's conventions for URI patterns. A generator
# may use this to generate methods to compose and decompose such names. The
# pattern should use named placeholders as in `shelves/{shelf}/books/{book}`;
# those will be taken as hints for the parameter names of the generated
# methods. If empty, no name methods are generated.
# The entity_name is the name to be used as a basis for generated methods and
# classes.
collections:
- name_pattern: accounts/{account}
entity_name: account
# Definition for retryable codes.
retry_codes_def:
- name: idempotent
retry_codes:
- DEADLINE_EXCEEDED
- UNAVAILABLE
- name: non_idempotent
retry_codes: []
# Definition for retry/backoff parameters.
retry_params_def:
- name: default
initial_retry_delay_millis: 100
retry_delay_multiplier: 1.3
max_retry_delay_millis: 60000
initial_rpc_timeout_millis: 20000
rpc_timeout_multiplier: 1
max_rpc_timeout_millis: 20000
total_timeout_millis: 600000
# A list of method configurations.
# Common properties:
#
# name - The simple name of the method.
#
# flattening - Specifies the configuration for parameter flattening.
# Describes the parameter groups for which a generator should produce method
# overloads which allow a client to directly pass request message fields as
# method parameters. This information may or may not be used, depending on
# the target language.
# Consists of groups, which each represent a list of parameters to be
# flattened. Each parameter listed must be a field of the request message.
#
# required_fields - Fields that are always required for a request to be
# valid.
#
# page_streaming - Specifies the configuration for paging.
# Describes information for generating a method which transforms a paging
# list RPC into a stream of resources.
# Consists of a request and a response.
# The request specifies request information of the list method. It defines
# which fields match the paging pattern in the request. The request consists
# of a page_size_field and a token_field. The page_size_field is the name of
# the optional field specifying the maximum number of elements to be
# returned in the response. The token_field is the name of the field in the
# request containing the page token.
# The response specifies response information of the list method. It defines
# which fields match the paging pattern in the response. The response
# consists of a token_field and a resources_field. The token_field is the
# name of the field in the response containing the next page token. The
# resources_field is the name of the field in the response containing the
# list of resources belonging to the page.
#
# retry_codes_name - Specifies the configuration for retryable codes. The
# name must be defined in interfaces.retry_codes_def.
#
# retry_params_name - Specifies the configuration for retry/backoff
# parameters. The name must be defined in interfaces.retry_params_def.
#
# field_name_patterns - Maps the field name of the request type to
# entity_name of interfaces.collections.
# Specifies the string pattern that the field must follow.
#
# timeout_millis - Specifies the default timeout for a non-retrying call. If
# the call is retrying, refer to retry_params_name instead.
methods:
- name: GetPublisherAccount
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: account
timeout_millis: 60000
- name: ListPublisherAccounts
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: account
retry_codes_name: idempotent
retry_params_name: default
timeout_millis: 60000
- name: GenerateNetworkReport
flattening:
groups:
- parameters:
- parent
- report_spec
required_fields:
- parent
- report_spec
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: account
timeout_millis: 60000
- name: GenerateMediationReport
flattening:
groups:
- parameters:
- parent
- report_spec
required_fields:
- parent
- report_spec
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: account
timeout_millis: 60000

View File

@ -0,0 +1,567 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.ads.admob.v1;
import "google/type/date.proto";
option go_package = "google.golang.org/genproto/googleapis/ads/admob/v1;admob";
option java_outer_classname = "AdMobResourceProto";
option java_package = "com.google.ads.admob.v1";
// A publisher account contains information relevant to the use of this API,
// such as the time zone used for the reports.
message PublisherAccount {
// Resource name of this account.
// Format is accounts/{publisher_id}.
string name = 1;
// The unique ID by which this publisher account can be identified
// in the API requests (for example, pub-1234567890).
string publisher_id = 2;
// The time zone that is used in reports that are generated for this account.
// The value is a time-zone ID as specified by the CLDR project,
// for example, "America/Los_Angeles".
string reporting_time_zone = 3;
// Currency code of the earning-related metrics, which is the 3-letter code
// defined in ISO 4217. The daily average rate is used for the currency
// conversion.
string currency_code = 4;
}
// The specification for generating an AdMob Network report.
// For example, the specification to get clicks and estimated earnings for only
// the 'US' and 'CN' countries can look like the following example:
//
// {
// 'date_range': {
// 'start_date': {'year': 2018, 'month': 9, 'day': 1},
// 'end_date': {'year': 2018, 'month': 9, 'day': 30}
// },
// 'dimensions': ['DATE', 'APP', 'COUNTRY'],
// 'metrics': ['CLICKS', 'ESTIMATED_EARNINGS'],
// 'dimension_filters': [
// {
// 'dimension': 'COUNTRY',
// 'matches_any': {'values': [{'value': 'US', 'value': 'CN'}]}
// }
// ],
// 'sort_conditions': [
// {'dimension':'APP', order: 'ASCENDING'},
// {'metric':'CLICKS', order: 'DESCENDING'}
// ],
// 'localization_settings': {
// 'currency_code': 'USD',
// 'language_code': 'en-US'
// }
// }
//
// For a better understanding, you can treat the preceding specification like
// the following pseudo SQL:
//
// SELECT DATE, APP, COUNTRY, CLICKS, ESTIMATED_EARNINGS
// FROM NETWORK_REPORT
// WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
// AND COUNTRY IN ('US', 'CN')
// GROUP BY DATE, APP, COUNTRY
// ORDER BY APP ASC, CLICKS DESC;
message NetworkReportSpec {
// Describes which report rows to match based on their dimension values.
message DimensionFilter {
// Applies the filter criterion to the specified dimension.
Dimension dimension = 1;
// Filter operator to be applied.
oneof operator {
// Matches a row if its value for the specified dimension is in one of the
// values specified in this condition.
StringList matches_any = 2;
}
}
// Sorting direction to be applied on a dimension or a metric.
message SortCondition {
// Identifies which values to sort on.
oneof sort_on {
// Sort by the specified dimension.
Dimension dimension = 1;
// Sort by the specified metric.
Metric metric = 2;
}
// Sorting order of the dimension or metric.
SortOrder order = 3;
}
// The dimensions of the network report. Dimensions are data attributes to
// break down or refine the quantitative measurements (metrics) by certain
// attributes, such as the ad format or the platform an ad was viewed on.
enum Dimension {
// Default value for an unset field. Do not use.
DIMENSION_UNSPECIFIED = 0;
// A date in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can
// specify at most one time dimension.
DATE = 1;
// A month in the YYYY-MM format (for example, "2018-12"). Requests can
// specify at most one time dimension.
MONTH = 2;
// The date of the first day of a week in the YYYY-MM-DD format
// (for example, "2018-12-21"). Requests can specify at most one time
// dimension.
WEEK = 3;
// The unique ID of the ad unit (for example, "ca-app-pub-1234/1234").
// If AD_UNIT dimension is specified, then APP is included automatically.
AD_UNIT = 4;
// The unique ID of the mobile application (for example,
// "ca-app-pub-1234~1234").
APP = 5;
// CLDR country code of the place where the ad views/clicks occur (for
// example, "US" or "FR"). This is a geography dimension.
COUNTRY = 7;
// Format of the ad unit (for example, "banner", "native"), an ad delivery
// dimension.
FORMAT = 8;
// Mobile OS platform of the app (for example, "Android" or "iOS").
PLATFORM = 9;
}
// The metrics of the network report. Metrics are quantitative measurements
// indicating how the publisher business is performing. They are aggregated
// from the individual ad events and grouped by the report dimensions. The
// metric value is either integer, or decimal (without rounding).
enum Metric {
// Default value for an unset field. Do not use.
METRIC_UNSPECIFIED = 0;
// The number of ad requests. The value is an integer.
AD_REQUESTS = 1;
// The number of times a user clicks an ad. The value is an integer.
CLICKS = 2;
// The estimated earnings of the AdMob publisher. The currency unit (USD,
// EUR, or other) of the earning metrics are determined by the localization
// setting for currency. The amount is in micros. For example, $6.50 would
// be represented as 6500000.
ESTIMATED_EARNINGS = 3;
// The total number of ads shown to users. The value is an integer.
IMPRESSIONS = 4;
// The ratio of clicks over impressions. The value is a double precision
// (approximate) decimal value.
IMPRESSION_CTR = 5;
// The estimated earnings per thousand ad impressions. The value is in
// micros. For example, $1.03 would be represented as 1030000.
IMPRESSION_RPM = 6;
// The number of times ads are returned in response to a request. The value
// is an integer.
MATCHED_REQUESTS = 7;
// The ratio of matched ad requests over the total ad requests. The value is
// a double precision (approximate) decimal value.
MATCH_RATE = 8;
// The ratio of ads that are displayed over ads that are returned, defined
// as impressions / matched requests. The value is a double precision
// (approximate) decimal value.
SHOW_RATE = 9;
}
// The date range for which the report is generated.
DateRange date_range = 1;
// List of dimensions of the report. The value combination of these dimensions
// determines the row of the report. If no dimensions are specified, the
// report returns a single row of requested metrics for the entire account.
repeated Dimension dimensions = 2;
// List of metrics of the report. A report must specify at least one metric.
repeated Metric metrics = 3;
// Describes which report rows to match based on their dimension values.
repeated DimensionFilter dimension_filters = 4;
// Describes the sorting of report rows. The order of the condition in the
// list defines its precedence; the earlier the condition, the higher its
// precedence. If no sort conditions are specified, the row ordering is
// undefined.
repeated SortCondition sort_conditions = 5;
// Localization settings of the report.
LocalizationSettings localization_settings = 6;
// Maximum number of report data rows to return. If the value is not set, the
// API returns as many rows as possible, up to 100000. Acceptable values are
// 1-100000, inclusive. Any other values are treated as 100000.
int32 max_report_rows = 7;
}
// The specification for generating an AdMob Mediation report.
// For example, the specification to get observed ECPM sliced by ad source and
// app for the 'US' and 'CN' countries can look like the following example:
//
// {
// "date_range": {
// "start_date": {"year": 2018, "month": 9, "day": 1},
// "end_date": {"year": 2018, "month": 9, "day": 30}
// },
// "dimensions": ["AD_SOURCE", "APP", "COUNTRY"],
// "metrics": ["OBSERVED_ECPM"],
// "dimension_filters": [
// {
// "dimension": "COUNTRY",
// "matches_any": {"values": [{"value": "US", "value": "CN"}]}
// }
// ],
// "sort_conditions": [
// {"dimension":"APP", order: "ASCENDING"}
// ],
// "localization_settings": {
// "currency_code": "USD",
// "language_code": "en-US"
// }
// }
//
// For a better understanding, you can treat the preceding specification like
// the following pseudo SQL:
//
// SELECT AD_SOURCE, APP, COUNTRY, OBSERVED_ECPM
// FROM MEDIATION_REPORT
// WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
// AND COUNTRY IN ('US', 'CN')
// GROUP BY AD_SOURCE, APP, COUNTRY
// ORDER BY APP ASC;
message MediationReportSpec {
// Describes which report rows to match based on their dimension values.
message DimensionFilter {
// Applies the filter criterion to the specified dimension.
Dimension dimension = 1;
// Filter operator to be applied.
oneof operator {
// Matches a row if its value for the specified dimension is in one of the
// values specified in this condition.
StringList matches_any = 2;
}
}
// Sorting direction to be applied on a dimension or a metric.
message SortCondition {
// Identifies which values to sort on.
oneof sort_on {
// Sort by the specified dimension.
Dimension dimension = 1;
// Sort by the specified metric.
Metric metric = 2;
}
// Sorting order of the dimension or metric.
SortOrder order = 3;
}
// The dimensions of the mediation report. Dimensions are data attributes to
// break down or refine the quantitative measurements (metrics) by certain
// attributes, such as the ad format or the platform an ad was viewed on.
enum Dimension {
// Default value for an unset field. Do not use.
DIMENSION_UNSPECIFIED = 0;
// A date in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can
// specify at most one time dimension.
DATE = 1;
// A month in the YYYY-MM format (for example, "2018-12"). Requests can
// specify at most one time dimension.
MONTH = 2;
// The date of the first day of a week in the YYYY-MM-DD format
// (for example, "2018-12-21"). Requests can specify at most one time
// dimension.
WEEK = 3;
// The unique ID of the ad source (for example, "5450213213286189855" and
// "AdMob Network" as label value).
AD_SOURCE = 4;
// The unique ID of the ad source instance (for example,
// "ca-app-pub-1234#5678" and "AdMob (default)" as label value).
// Warning: The dimension is incompatible with ESTIMATED_EARNINGS and
// OBSERVED_ECPM metrics.
AD_SOURCE_INSTANCE = 5;
// The unique ID of the ad unit (for example, "ca-app-pub-1234/8790").
// If AD_UNIT dimension is specified, then APP is included automatically.
AD_UNIT = 6;
// The unique ID of the mobile application (for example,
// "ca-app-pub-1234~1234").
APP = 7;
// The unique ID of the mediation group (for example,
// "ca-app-pub-1234:mg:1234" and "AdMob (default)" as label value).
// Warning: The dimension is incompatible with ESTIMATED_EARNINGS and
// OBSERVED_ECPM metrics.
MEDIATION_GROUP = 11;
// CLDR country code of the place where the ad views/clicks occur (for
// example, "US" or "FR"). This is a geography dimension.
COUNTRY = 8;
// Format of the ad unit (for example, "banner", "native"), an ad delivery
// dimension.
FORMAT = 9;
// Mobile OS platform of the app (for example, "Android" or "iOS").
PLATFORM = 10;
}
// The metrics of the mediation report. Metrics are quantitative measurements
// indicating how the publisher business is performing. They are aggregated
// from the individual ad events and grouped by the report dimensions. The
// metric value is either integer, or decimal (without rounding).
enum Metric {
// Default value for an unset field. Do not use.
METRIC_UNSPECIFIED = 0;
// The number of requests. The value is an integer.
AD_REQUESTS = 1;
// The number of times a user clicks an ad. The value is an integer.
CLICKS = 2;
// The estimated earnings of the AdMob publisher. The currency unit (USD,
// EUR, or other) of the earning metrics are determined by the localization
// setting for currency. The amount is in micros. For example, $6.50 would
// be represented as 6500000.
// Warning: The metric is incompatible with AD_SOURCE_INSTANCE and
// MEDIATION_GROUP dimensions.
ESTIMATED_EARNINGS = 3;
// The total number of ads shown to users. The value is an integer.
IMPRESSIONS = 4;
// The ratio of clicks over impressions. The value is a double precision
// (approximate) decimal value.
IMPRESSION_CTR = 5;
// The number of times ads are returned in response to a request. The value
// is an integer.
MATCHED_REQUESTS = 6;
// The ratio of matched ad requests over the total ad requests. The value is
// a double precision (approximate) decimal value.
MATCH_RATE = 7;
// The third-party ad network's estimated average eCPM. The currency unit
// (USD, EUR, or other) of the earning metrics are determined by the
// localization setting for currency. The amount is in micros. For example,
// $2.30 would be represented as 2300000.
// Warning: The metric is incompatible with AD_SOURCE_INSTANCE and
// MEDIATION_GROUP dimensions.
OBSERVED_ECPM = 8;
}
// The date range for which the report is generated.
DateRange date_range = 1;
// List of dimensions of the report. The value combination of these dimensions
// determines the row of the report. If no dimensions are specified, the
// report returns a single row of requested metrics for the entire account.
repeated Dimension dimensions = 2;
// List of metrics of the report. A report must specify at least one metric.
repeated Metric metrics = 3;
// Describes which report rows to match based on their dimension values.
repeated DimensionFilter dimension_filters = 4;
// Describes the sorting of report rows. The order of the condition in the
// list defines its precedence; the earlier the condition, the higher its
// precedence. If no sort conditions are specified, the row ordering is
// undefined.
repeated SortCondition sort_conditions = 5;
// Localization settings of the report.
LocalizationSettings localization_settings = 6;
// Maximum number of report data rows to return. If the value is not set, the
// API returns as many rows as possible, up to 100000. Acceptable values are
// 1-100000, inclusive. Any other values are treated as 100000.
int32 max_report_rows = 7;
}
// A row of the returning report.
message ReportRow {
// Representation of a dimension value.
message DimensionValue {
// Dimension value in the format specified in the report's spec Dimension
// enum.
string value = 1;
// The localized string representation of the value. If unspecified, the
// display label should be derived from the value.
string display_label = 2;
}
// Representation of a metric value.
message MetricValue {
// Metric value in the format specified in the report's spec Metric enum
// name.
oneof value {
// Metric integer value.
int64 integer_value = 1;
// Double precision (approximate) decimal values. Rates are from 0 to 1.
double double_value = 2;
// Amount in micros. One million is equivalent to one unit. Currency value
// is in the unit (USD, EUR or other) specified by the request.
// For example, $6.50 whould be represented as 6500000 micros.
int64 micros_value = 3;
}
}
// Map of dimension values in a row, with keys as enum name of the dimensions.
map<string, DimensionValue> dimension_values = 1;
// Map of metric values in a row, with keys as enum name of the metrics. If
// a metric being requested has no value returned, the map will not include
// it.
map<string, MetricValue> metric_values = 2;
}
// Warnings associated with generation of the report.
message ReportWarning {
// Warning type.
enum Type {
// Default value for an unset field. Do not use.
TYPE_UNSPECIFIED = 0;
// Some data in this report is aggregated based on a time zone different
// from the requested time zone. This could happen if a local time-zone
// report has the start time before the last time this time zone changed.
// The description field will contain the date of the last time zone
// change.
DATA_BEFORE_ACCOUNT_TIMEZONE_CHANGE = 1;
// There is an unusual delay in processing the source data for the
// requested date range. The report results might be less up to date than
// usual. AdMob is aware of the issue and is actively working to resolve
// it.
DATA_DELAYED = 2;
// Warnings that are exposed without a specific type. Useful when new
// warning types are added but the API is not changed yet.
OTHER = 3;
// The currency being requested is not the account currency. The earning
// metrics will be based on the requested currency, and thus not a good
// estimation of the final payment anymore, due to the currency rate
// fluctuation.
REPORT_CURRENCY_NOT_ACCOUNT_CURRENCY = 4;
}
// Type of the warning.
Type type = 1;
// Describes the details of the warning message, in English.
string description = 2;
}
// Groups data helps to treat the generated report. Always sent as a first
// message in the stream response.
message ReportHeader {
// The date range for which the report is generated. This is identical to the
// range specified in the report request.
DateRange date_range = 1;
// Localization settings of the report. This is identical to the settings
// in the report request.
LocalizationSettings localization_settings = 2;
// The report time zone. The value is a time-zone ID as specified by the CLDR
// project, for example, "America/Los_Angeles".
string reporting_time_zone = 3;
}
// Groups data available after report generation, for example, warnings and row
// counts. Always sent as the last message in the stream response.
message ReportFooter {
// Warnings associated with generation of the report.
repeated ReportWarning warnings = 1;
// Total number of rows that did match the request.
int64 matching_row_count = 2;
}
// Specification of a single date range. Both dates are inclusive.
message DateRange {
// Start date of the date range, inclusive. Must be less than or equal to the
// end date.
google.type.Date start_date = 1;
// End date of the date range, inclusive. Must be greater than or equal to the
// start date.
google.type.Date end_date = 2;
}
// Localization settings for reports, such as currency and language. It affects
// how metrics are calculated.
message LocalizationSettings {
// Currency code of the earning related metrics, which is the 3-letter code
// defined in ISO 4217. The daily average rate is used for the currency
// conversion. Defaults to the account currency code if unspecified.
string currency_code = 1;
// Language used for any localized text, such as some dimension value display
// labels. The language tag defined in the IETF BCP47. Defaults to 'en-US' if
// unspecified.
string language_code = 2;
}
// List of string values.
message StringList {
// The string values.
repeated string values = 1;
}
// The sorting order.
enum SortOrder {
// Default value for an unset field. Do not use.
SORT_ORDER_UNSPECIFIED = 0;
// Sort dimension value or metric value in ascending order.
ASCENDING = 1;
// Sort dimension value or metric value in descending order.
DESCENDING = 2;
}