1 // Copyright 2024 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package dfareporting provides access to the Campaign Manager 360 API. 8 // 9 // For product documentation, see: https://developers.google.com/doubleclick-advertisers/ 10 // 11 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/dfareporting/v3.5" 27 // ... 28 // ctx := context.Background() 29 // dfareportingService, err := dfareporting.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // To use an API key for authentication (note: some APIs do not support API 38 // keys), use [google.golang.org/api/option.WithAPIKey]: 39 // 40 // dfareportingService, err := dfareporting.NewService(ctx, option.WithAPIKey("AIza...")) 41 // 42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 43 // flow, use [google.golang.org/api/option.WithTokenSource]: 44 // 45 // config := &oauth2.Config{...} 46 // // ... 47 // token, err := config.Exchange(ctx, ...) 48 // dfareportingService, err := dfareporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package dfareporting // import "google.golang.org/api/dfareporting/v3.5" 52 53 import ( 54 "bytes" 55 "context" 56 "encoding/json" 57 "errors" 58 "fmt" 59 "io" 60 "net/http" 61 "net/url" 62 "strconv" 63 "strings" 64 65 googleapi "google.golang.org/api/googleapi" 66 internal "google.golang.org/api/internal" 67 gensupport "google.golang.org/api/internal/gensupport" 68 option "google.golang.org/api/option" 69 internaloption "google.golang.org/api/option/internaloption" 70 htransport "google.golang.org/api/transport/http" 71 ) 72 73 // Always reference these packages, just in case the auto-generated code 74 // below doesn't. 75 var _ = bytes.NewBuffer 76 var _ = strconv.Itoa 77 var _ = fmt.Sprintf 78 var _ = json.NewDecoder 79 var _ = io.Copy 80 var _ = url.Parse 81 var _ = gensupport.MarshalJSON 82 var _ = googleapi.Version 83 var _ = errors.New 84 var _ = strings.Replace 85 var _ = context.Canceled 86 var _ = internaloption.WithDefaultEndpoint 87 var _ = internal.Version 88 89 const apiId = "dfareporting:v3.5" 90 const apiName = "dfareporting" 91 const apiVersion = "v3.5" 92 const basePath = "https://dfareporting.googleapis.com/dfareporting/v3.5/" 93 const basePathTemplate = "https://dfareporting.UNIVERSE_DOMAIN/dfareporting/v3.5/" 94 const mtlsBasePath = "https://dfareporting.mtls.googleapis.com/dfareporting/v3.5/" 95 96 // OAuth2 scopes used by this API. 97 const ( 98 // View and manage your DoubleClick Campaign Manager's (DCM) display ad 99 // campaigns 100 DfatraffickingScope = "https://www.googleapis.com/auth/dfatrafficking" 101 ) 102 103 // NewService creates a new Service. 104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 105 scopesOption := internaloption.WithDefaultScopes( 106 "https://www.googleapis.com/auth/dfatrafficking", 107 ) 108 // NOTE: prepend, so we don't override user-specified scopes. 109 opts = append([]option.ClientOption{scopesOption}, opts...) 110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 113 opts = append(opts, internaloption.EnableNewAuthLibrary()) 114 client, endpoint, err := htransport.NewClient(ctx, opts...) 115 if err != nil { 116 return nil, err 117 } 118 s, err := New(client) 119 if err != nil { 120 return nil, err 121 } 122 if endpoint != "" { 123 s.BasePath = endpoint 124 } 125 return s, nil 126 } 127 128 // New creates a new Service. It uses the provided http.Client for requests. 129 // 130 // Deprecated: please use NewService instead. 131 // To provide a custom HTTP client, use option.WithHTTPClient. 132 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 133 func New(client *http.Client) (*Service, error) { 134 if client == nil { 135 return nil, errors.New("client is nil") 136 } 137 s := &Service{client: client, BasePath: basePath} 138 s.Media = NewMediaService(s) 139 return s, nil 140 } 141 142 type Service struct { 143 client *http.Client 144 BasePath string // API endpoint base URL 145 UserAgent string // optional additional User-Agent fragment 146 147 Media *MediaService 148 } 149 150 func (s *Service) userAgent() string { 151 if s.UserAgent == "" { 152 return googleapi.UserAgent 153 } 154 return googleapi.UserAgent + " " + s.UserAgent 155 } 156 157 func NewMediaService(s *Service) *MediaService { 158 rs := &MediaService{s: s} 159 return rs 160 } 161 162 type MediaService struct { 163 s *Service 164 } 165 166 // ClickTag: Creative Click Tag. 167 type ClickTag struct { 168 // ClickThroughUrl: Parameter value for the specified click tag. This field 169 // contains a click-through url. 170 ClickThroughUrl *CreativeClickThroughUrl `json:"clickThroughUrl,omitempty"` 171 // EventName: Advertiser event name associated with the click tag. This field 172 // is used by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to 173 // DISPLAY when the primary asset type is not HTML_IMAGE. 174 EventName string `json:"eventName,omitempty"` 175 // Name: Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY 176 // creative assets, this field must match the value of the creative asset's 177 // creativeAssetId.name field. 178 Name string `json:"name,omitempty"` 179 // ForceSendFields is a list of field names (e.g. "ClickThroughUrl") to 180 // unconditionally include in API requests. By default, fields with empty or 181 // default values are omitted from API requests. See 182 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 183 // details. 184 ForceSendFields []string `json:"-"` 185 // NullFields is a list of field names (e.g. "ClickThroughUrl") to include in 186 // API requests with the JSON null value. By default, fields with empty values 187 // are omitted from API requests. See 188 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 189 NullFields []string `json:"-"` 190 } 191 192 func (s *ClickTag) MarshalJSON() ([]byte, error) { 193 type NoMethod ClickTag 194 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 195 } 196 197 // CreativeAssetId: Creative Asset ID. 198 type CreativeAssetId struct { 199 // Name: Name of the creative asset. This is a required field while inserting 200 // an asset. After insertion, this assetIdentifier is used to identify the 201 // uploaded asset. Characters in the name must be alphanumeric or one of the 202 // following: ".-_ ". Spaces are allowed. 203 Name string `json:"name,omitempty"` 204 // Type: Type of asset to upload. This is a required field. FLASH and IMAGE are 205 // no longer supported for new uploads. All image assets should use HTML_IMAGE. 206 // 207 // Possible values: 208 // "IMAGE" 209 // "FLASH" 210 // "VIDEO" 211 // "HTML" 212 // "HTML_IMAGE" 213 // "AUDIO" 214 Type string `json:"type,omitempty"` 215 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally 216 // include in API requests. By default, fields with empty or default values are 217 // omitted from API requests. See 218 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 219 // details. 220 ForceSendFields []string `json:"-"` 221 // NullFields is a list of field names (e.g. "Name") to include in API requests 222 // with the JSON null value. By default, fields with empty values are omitted 223 // from API requests. See 224 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 225 NullFields []string `json:"-"` 226 } 227 228 func (s *CreativeAssetId) MarshalJSON() ([]byte, error) { 229 type NoMethod CreativeAssetId 230 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 231 } 232 233 // CreativeAssetMetadata: CreativeAssets contains properties of a creative 234 // asset file which will be uploaded or has already been uploaded. Refer to the 235 // creative sample code for how to upload assets and insert a creative. 236 type CreativeAssetMetadata struct { 237 // AssetIdentifier: ID of the creative asset. This is a required field. 238 AssetIdentifier *CreativeAssetId `json:"assetIdentifier,omitempty"` 239 // ClickTags: List of detected click tags for assets. This is a read-only, 240 // auto-generated field. This field is empty for a rich media asset. 241 ClickTags []*ClickTag `json:"clickTags,omitempty"` 242 // CounterCustomEvents: List of counter events configured for the asset. This 243 // is a read-only, auto-generated field and only applicable to a rich media 244 // asset. 245 CounterCustomEvents []*CreativeCustomEvent `json:"counterCustomEvents,omitempty"` 246 // DetectedFeatures: List of feature dependencies for the creative asset that 247 // are detected by Campaign Manager. Feature dependencies are features that a 248 // browser must be able to support in order to render your HTML5 creative 249 // correctly. This is a read-only, auto-generated field. 250 // 251 // Possible values: 252 // "CSS_FONT_FACE" 253 // "CSS_BACKGROUND_SIZE" 254 // "CSS_BORDER_IMAGE" 255 // "CSS_BORDER_RADIUS" 256 // "CSS_BOX_SHADOW" 257 // "CSS_FLEX_BOX" 258 // "CSS_HSLA" 259 // "CSS_MULTIPLE_BGS" 260 // "CSS_OPACITY" 261 // "CSS_RGBA" 262 // "CSS_TEXT_SHADOW" 263 // "CSS_ANIMATIONS" 264 // "CSS_COLUMNS" 265 // "CSS_GENERATED_CONTENT" 266 // "CSS_GRADIENTS" 267 // "CSS_REFLECTIONS" 268 // "CSS_TRANSFORMS" 269 // "CSS_TRANSFORMS3D" 270 // "CSS_TRANSITIONS" 271 // "APPLICATION_CACHE" 272 // "CANVAS" 273 // "CANVAS_TEXT" 274 // "DRAG_AND_DROP" 275 // "HASH_CHANGE" 276 // "HISTORY" 277 // "AUDIO" 278 // "VIDEO" 279 // "INDEXED_DB" 280 // "INPUT_ATTR_AUTOCOMPLETE" 281 // "INPUT_ATTR_AUTOFOCUS" 282 // "INPUT_ATTR_LIST" 283 // "INPUT_ATTR_PLACEHOLDER" 284 // "INPUT_ATTR_MAX" 285 // "INPUT_ATTR_MIN" 286 // "INPUT_ATTR_MULTIPLE" 287 // "INPUT_ATTR_PATTERN" 288 // "INPUT_ATTR_REQUIRED" 289 // "INPUT_ATTR_STEP" 290 // "INPUT_TYPE_SEARCH" 291 // "INPUT_TYPE_TEL" 292 // "INPUT_TYPE_URL" 293 // "INPUT_TYPE_EMAIL" 294 // "INPUT_TYPE_DATETIME" 295 // "INPUT_TYPE_DATE" 296 // "INPUT_TYPE_MONTH" 297 // "INPUT_TYPE_WEEK" 298 // "INPUT_TYPE_TIME" 299 // "INPUT_TYPE_DATETIME_LOCAL" 300 // "INPUT_TYPE_NUMBER" 301 // "INPUT_TYPE_RANGE" 302 // "INPUT_TYPE_COLOR" 303 // "LOCAL_STORAGE" 304 // "POST_MESSAGE" 305 // "SESSION_STORAGE" 306 // "WEB_SOCKETS" 307 // "WEB_SQL_DATABASE" 308 // "WEB_WORKERS" 309 // "GEO_LOCATION" 310 // "INLINE_SVG" 311 // "SMIL" 312 // "SVG_HREF" 313 // "SVG_CLIP_PATHS" 314 // "TOUCH" 315 // "WEBGL" 316 // "SVG_FILTERS" 317 // "SVG_FE_IMAGE" 318 DetectedFeatures []string `json:"detectedFeatures,omitempty"` 319 // ExitCustomEvents: List of exit events configured for the asset. This is a 320 // read-only, auto-generated field and only applicable to a rich media asset. 321 ExitCustomEvents []*CreativeCustomEvent `json:"exitCustomEvents,omitempty"` 322 // Id: Numeric ID of the asset. This is a read-only, auto-generated field. 323 Id int64 `json:"id,omitempty,string"` 324 // IdDimensionValue: Dimension value for the numeric ID of the asset. This is a 325 // read-only, auto-generated field. 326 IdDimensionValue *DimensionValue `json:"idDimensionValue,omitempty"` 327 // Kind: Identifies what kind of resource this is. Value: the fixed string 328 // "dfareporting#creativeAssetMetadata". 329 Kind string `json:"kind,omitempty"` 330 MediaRequestInfo *MediaRequestInfo `json:"mediaRequestInfo,omitempty"` 331 MediaResponseInfo *MediaResponseInfo `json:"mediaResponseInfo,omitempty"` 332 // RichMedia: True if the uploaded asset is a rich media asset. This is a 333 // read-only, auto-generated field. 334 RichMedia bool `json:"richMedia,omitempty"` 335 // TimerCustomEvents: List of timer events configured for the asset. This is a 336 // read-only, auto-generated field and only applicable to a rich media asset. 337 TimerCustomEvents []*CreativeCustomEvent `json:"timerCustomEvents,omitempty"` 338 // WarnedValidationRules: Rules validated during code generation that generated 339 // a warning. This is a read-only, auto-generated field. Possible values are: - 340 // "ADMOB_REFERENCED" - "ASSET_FORMAT_UNSUPPORTED_DCM" - "ASSET_INVALID" - 341 // "CLICK_TAG_HARD_CODED" - "CLICK_TAG_INVALID" - "CLICK_TAG_IN_GWD" - 342 // "CLICK_TAG_MISSING" - "CLICK_TAG_MORE_THAN_ONE" - "CLICK_TAG_NON_TOP_LEVEL" 343 // - "COMPONENT_UNSUPPORTED_DCM" - "ENABLER_UNSUPPORTED_METHOD_DCM" - 344 // "EXTERNAL_FILE_REFERENCED" - "FILE_DETAIL_EMPTY" - "FILE_TYPE_INVALID" - 345 // "GWD_PROPERTIES_INVALID" - "HTML5_FEATURE_UNSUPPORTED" - 346 // "LINKED_FILE_NOT_FOUND" - "MAX_FLASH_VERSION_11" - "MRAID_REFERENCED" - 347 // "NOT_SSL_COMPLIANT" - "ORPHANED_ASSET" - "PRIMARY_HTML_MISSING" - 348 // "SVG_INVALID" - "ZIP_INVALID" 349 // 350 // Possible values: 351 // "CLICK_TAG_NON_TOP_LEVEL" 352 // "CLICK_TAG_MISSING" 353 // "CLICK_TAG_MORE_THAN_ONE" 354 // "CLICK_TAG_INVALID" 355 // "ORPHANED_ASSET" 356 // "PRIMARY_HTML_MISSING" 357 // "EXTERNAL_FILE_REFERENCED" 358 // "MRAID_REFERENCED" 359 // "ADMOB_REFERENCED" 360 // "FILE_TYPE_INVALID" 361 // "ZIP_INVALID" 362 // "LINKED_FILE_NOT_FOUND" 363 // "MAX_FLASH_VERSION_11" 364 // "NOT_SSL_COMPLIANT" 365 // "FILE_DETAIL_EMPTY" 366 // "ASSET_INVALID" 367 // "GWD_PROPERTIES_INVALID" 368 // "ENABLER_UNSUPPORTED_METHOD_DCM" 369 // "ASSET_FORMAT_UNSUPPORTED_DCM" 370 // "COMPONENT_UNSUPPORTED_DCM" 371 // "HTML5_FEATURE_UNSUPPORTED" 372 // "CLICK_TAG_IN_GWD" 373 // "CLICK_TAG_HARD_CODED" 374 // "SVG_INVALID" 375 // "CLICK_TAG_IN_RICH_MEDIA" 376 // "MISSING_ENABLER_REFERENCE" 377 WarnedValidationRules []string `json:"warnedValidationRules,omitempty"` 378 379 // ServerResponse contains the HTTP response code and headers from the server. 380 googleapi.ServerResponse `json:"-"` 381 // ForceSendFields is a list of field names (e.g. "AssetIdentifier") to 382 // unconditionally include in API requests. By default, fields with empty or 383 // default values are omitted from API requests. See 384 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 385 // details. 386 ForceSendFields []string `json:"-"` 387 // NullFields is a list of field names (e.g. "AssetIdentifier") to include in 388 // API requests with the JSON null value. By default, fields with empty values 389 // are omitted from API requests. See 390 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 391 NullFields []string `json:"-"` 392 } 393 394 func (s *CreativeAssetMetadata) MarshalJSON() ([]byte, error) { 395 type NoMethod CreativeAssetMetadata 396 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 397 } 398 399 // CreativeClickThroughUrl: Click-through URL 400 type CreativeClickThroughUrl struct { 401 // ComputedClickThroughUrl: Read-only convenience field representing the actual 402 // URL that will be used for this click-through. The URL is computed as 403 // follows: - If landingPageId is specified then that landing page's URL is 404 // assigned to this field. - Otherwise, the customClickThroughUrl is assigned 405 // to this field. 406 ComputedClickThroughUrl string `json:"computedClickThroughUrl,omitempty"` 407 // CustomClickThroughUrl: Custom click-through URL. Applicable if the 408 // landingPageId field is left unset. 409 CustomClickThroughUrl string `json:"customClickThroughUrl,omitempty"` 410 // LandingPageId: ID of the landing page for the click-through URL. 411 LandingPageId int64 `json:"landingPageId,omitempty,string"` 412 // ForceSendFields is a list of field names (e.g. "ComputedClickThroughUrl") to 413 // unconditionally include in API requests. By default, fields with empty or 414 // default values are omitted from API requests. See 415 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 416 // details. 417 ForceSendFields []string `json:"-"` 418 // NullFields is a list of field names (e.g. "ComputedClickThroughUrl") to 419 // include in API requests with the JSON null value. By default, fields with 420 // empty values are omitted from API requests. See 421 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 422 NullFields []string `json:"-"` 423 } 424 425 func (s *CreativeClickThroughUrl) MarshalJSON() ([]byte, error) { 426 type NoMethod CreativeClickThroughUrl 427 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 428 } 429 430 // CreativeCustomEvent: Creative Custom Event. 431 type CreativeCustomEvent struct { 432 // AdvertiserCustomEventId: Unique ID of this event used by Reporting and Data 433 // Transfer. This is a read-only field. 434 AdvertiserCustomEventId int64 `json:"advertiserCustomEventId,omitempty,string"` 435 // AdvertiserCustomEventName: User-entered name for the event. 436 AdvertiserCustomEventName string `json:"advertiserCustomEventName,omitempty"` 437 // AdvertiserCustomEventType: Type of the event. This is a read-only field. 438 // 439 // Possible values: 440 // "ADVERTISER_EVENT_TIMER" 441 // "ADVERTISER_EVENT_EXIT" 442 // "ADVERTISER_EVENT_COUNTER" 443 AdvertiserCustomEventType string `json:"advertiserCustomEventType,omitempty"` 444 // ArtworkLabel: Artwork label column, used to link events in Campaign Manager 445 // back to events in Studio. This is a required field and should not be 446 // modified after insertion. 447 ArtworkLabel string `json:"artworkLabel,omitempty"` 448 // ArtworkType: Artwork type used by the creative.This is a read-only field. 449 // 450 // Possible values: 451 // "ARTWORK_TYPE_FLASH" 452 // "ARTWORK_TYPE_HTML5" 453 // "ARTWORK_TYPE_MIXED" 454 // "ARTWORK_TYPE_IMAGE" 455 ArtworkType string `json:"artworkType,omitempty"` 456 // ExitClickThroughUrl: Exit click-through URL for the event. This field is 457 // used only for exit events. 458 ExitClickThroughUrl *CreativeClickThroughUrl `json:"exitClickThroughUrl,omitempty"` 459 // Id: ID of this event. This is a required field and should not be modified 460 // after insertion. 461 Id int64 `json:"id,omitempty,string"` 462 // PopupWindowProperties: Properties for rich media popup windows. This field 463 // is used only for exit events. 464 PopupWindowProperties *PopupWindowProperties `json:"popupWindowProperties,omitempty"` 465 // TargetType: Target type used by the event. 466 // 467 // Possible values: 468 // "TARGET_BLANK" 469 // "TARGET_TOP" 470 // "TARGET_SELF" 471 // "TARGET_PARENT" 472 // "TARGET_POPUP" 473 TargetType string `json:"targetType,omitempty"` 474 // VideoReportingId: Video reporting ID, used to differentiate multiple videos 475 // in a single creative. This is a read-only field. 476 VideoReportingId string `json:"videoReportingId,omitempty"` 477 // ForceSendFields is a list of field names (e.g. "AdvertiserCustomEventId") to 478 // unconditionally include in API requests. By default, fields with empty or 479 // default values are omitted from API requests. See 480 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 481 // details. 482 ForceSendFields []string `json:"-"` 483 // NullFields is a list of field names (e.g. "AdvertiserCustomEventId") to 484 // include in API requests with the JSON null value. By default, fields with 485 // empty values are omitted from API requests. See 486 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 487 NullFields []string `json:"-"` 488 } 489 490 func (s *CreativeCustomEvent) MarshalJSON() ([]byte, error) { 491 type NoMethod CreativeCustomEvent 492 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 493 } 494 495 // DimensionValue: Represents a DimensionValue resource. 496 type DimensionValue struct { 497 // DimensionName: The name of the dimension. 498 DimensionName string `json:"dimensionName,omitempty"` 499 // Etag: The eTag of this response for caching purposes. 500 Etag string `json:"etag,omitempty"` 501 // Id: The ID associated with the value if available. 502 Id string `json:"id,omitempty"` 503 // Kind: The kind of resource this is, in this case 504 // dfareporting#dimensionValue. 505 Kind string `json:"kind,omitempty"` 506 // MatchType: Determines how the 'value' field is matched when filtering. If 507 // not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is 508 // allowed as a placeholder for variable length character sequences, and it can 509 // be escaped with a backslash. Note, only paid search dimensions 510 // ('dfa:paidSearch*') allow a matchType other than EXACT. 511 // 512 // Possible values: 513 // "EXACT" 514 // "BEGINS_WITH" 515 // "CONTAINS" 516 // "WILDCARD_EXPRESSION" 517 MatchType string `json:"matchType,omitempty"` 518 // Value: The value of the dimension. 519 Value string `json:"value,omitempty"` 520 // ForceSendFields is a list of field names (e.g. "DimensionName") to 521 // unconditionally include in API requests. By default, fields with empty or 522 // default values are omitted from API requests. See 523 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 524 // details. 525 ForceSendFields []string `json:"-"` 526 // NullFields is a list of field names (e.g. "DimensionName") to include in API 527 // requests with the JSON null value. By default, fields with empty values are 528 // omitted from API requests. See 529 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 530 NullFields []string `json:"-"` 531 } 532 533 func (s *DimensionValue) MarshalJSON() ([]byte, error) { 534 type NoMethod DimensionValue 535 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 536 } 537 538 // MediaRequestInfo: Extra information added to operations that support Scotty 539 // media requests. 540 type MediaRequestInfo struct { 541 // CurrentBytes: The number of current bytes uploaded or downloaded. 542 CurrentBytes int64 `json:"currentBytes,omitempty,string"` 543 // CustomData: Data to be copied to backend requests. Custom data is returned 544 // to Scotty in the agent_state field, which Scotty will then provide in 545 // subsequent upload notifications. 546 CustomData string `json:"customData,omitempty"` 547 // DiffObjectVersion: Set if the http request info is diff encoded. The value 548 // of this field is the version number of the base revision. This is 549 // corresponding to Apiary's mediaDiffObjectVersion 550 // (//depot/google3/java/com/google/api/server/media/variable/DiffObjectVersionV 551 // ariable.java). See go/esf-scotty-diff-upload for more information. 552 DiffObjectVersion string `json:"diffObjectVersion,omitempty"` 553 // FinalStatus: The existence of the final_status field indicates that this is 554 // the last call to the agent for this request_id. 555 // http://google3/uploader/agent/scotty_agent.proto?l=737&rcl=347601929 556 FinalStatus int64 `json:"finalStatus,omitempty"` 557 // NotificationType: The type of notification received from Scotty. 558 // 559 // Possible values: 560 // "START" - Such requests signals the start of a request containing media 561 // upload. Only the media field(s) in the inserted/updated resource are set. 562 // The response should either return an error or succeed. On success, responses 563 // don't need to contain anything. 564 // "PROGRESS" - Such requests signals that the upload has progressed and that 565 // the backend might want to access the media file specified in relevant fields 566 // in the resource. Only the media field(s) in the inserted/updated resource 567 // are set. The response should either return an error or succeed. On success, 568 // responses don't need to contain anything. 569 // "END" - Such requests signals the end of a request containing media 570 // upload. END should be handled just like normal Insert/Upload requests, that 571 // is, they should process the request and return a complete resource in the 572 // response. Pointers to media data (a GFS path usually) appear in the relevant 573 // fields in the inserted/updated resource. See gdata.Media in data.proto. 574 // "RESPONSE_SENT" - Such requests occur after an END and signal that the 575 // response has been sent back to the client. RESPONSE_SENT is only sent to the 576 // backend if it is configured to receive them. The response does not need to 577 // contain anything. 578 // "ERROR" - Such requests indicate that an error occurred while processing 579 // the request. ERROR is only sent to the backend if it is configured to 580 // receive them. It is not guaranteed that all errors will result in this 581 // notification to the backend, even if the backend requests them. Since these 582 // requests are just for informational purposes, the response does not need to 583 // contain anything. 584 NotificationType string `json:"notificationType,omitempty"` 585 // RequestId: The Scotty request ID. 586 RequestId string `json:"requestId,omitempty"` 587 // RequestReceivedParamsServingInfo: The partition of the Scotty server 588 // handling this request. type is 589 // uploader_service.RequestReceivedParamsServingInfo 590 // LINT.IfChange(request_received_params_serving_info_annotations) 591 // LINT.ThenChange() 592 RequestReceivedParamsServingInfo string `json:"requestReceivedParamsServingInfo,omitempty"` 593 // TotalBytes: The total size of the file. 594 TotalBytes int64 `json:"totalBytes,omitempty,string"` 595 // TotalBytesIsEstimated: Whether the total bytes field contains an estimated 596 // data. 597 TotalBytesIsEstimated bool `json:"totalBytesIsEstimated,omitempty"` 598 // ForceSendFields is a list of field names (e.g. "CurrentBytes") to 599 // unconditionally include in API requests. By default, fields with empty or 600 // default values are omitted from API requests. See 601 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 602 // details. 603 ForceSendFields []string `json:"-"` 604 // NullFields is a list of field names (e.g. "CurrentBytes") to include in API 605 // requests with the JSON null value. By default, fields with empty values are 606 // omitted from API requests. See 607 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 608 NullFields []string `json:"-"` 609 } 610 611 func (s *MediaRequestInfo) MarshalJSON() ([]byte, error) { 612 type NoMethod MediaRequestInfo 613 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 614 } 615 616 // MediaResponseInfo: This message is for backends to pass their scotty media 617 // specific fields to ESF. Backend will include this in their response message 618 // to ESF. Example: ExportFile is an rpc defined for upload using scotty from 619 // ESF. rpc ExportFile(ExportFileRequest) returns (ExportFileResponse) Message 620 // ExportFileResponse will include apiserving.MediaResponseInfo to tell ESF 621 // about data like dynamic_dropzone it needs to pass to Scotty. message 622 // ExportFileResponse { optional gdata.Media blob = 1; optional 623 // apiserving.MediaResponseInfo media_response_info = 2 } 624 type MediaResponseInfo struct { 625 // CustomData: Data to copy from backend response to the next backend requests. 626 // Custom data is returned to Scotty in the agent_state field, which Scotty 627 // will then provide in subsequent upload notifications. 628 CustomData string `json:"customData,omitempty"` 629 // DataStorageTransform: Specifies any transformation to be applied to data 630 // before persisting it or retrieving from storage. E.g., encryption options 631 // for blobstore2. This should be of the form 632 // uploader_service.DataStorageTransform. 633 DataStorageTransform string `json:"dataStorageTransform,omitempty"` 634 // DynamicDropTarget: Specifies the Scotty Drop Target to use for uploads. If 635 // present in a media response, Scotty does not upload to a standard drop zone. 636 // Instead, Scotty saves the upload directly to the location specified in this 637 // drop target. Unlike drop zones, the drop target is the final storage 638 // location for an upload. So, the agent does not need to clone the blob at the 639 // end of the upload. The agent is responsible for garbage collecting any 640 // orphaned blobs that may occur due to aborted uploads. For more information, 641 // see the drop target design doc here: http://goto/ScottyDropTarget This field 642 // will be preferred to dynamicDropzone. If provided, the identified field in 643 // the response must be of the type uploader.agent.DropTarget. 644 DynamicDropTarget string `json:"dynamicDropTarget,omitempty"` 645 // DynamicDropzone: Specifies the Scotty dropzone to use for uploads. 646 DynamicDropzone string `json:"dynamicDropzone,omitempty"` 647 // RequestClass: Request class to use for all Blobstore operations for this 648 // request. 649 // 650 // Possible values: 651 // "UNKNOWN_REQUEST_CLASS" - Unpopulated request_class in log files will be 652 // taken as 0 in dremel query. GoogleSQL will try to cast it to enum by 653 // default. An unused 0 value is added to avoid GoogleSQL casting error. Please 654 // refer to b/69677280. 655 // "LATENCY_SENSITIVE" - A latency-sensitive request. 656 // "PRODUCTION_BATCH" - A request generated by a batch process. 657 // "BEST_EFFORT" - A best-effort request. 658 RequestClass string `json:"requestClass,omitempty"` 659 // ScottyAgentUserId: Requester ID passed along to be recorded in the Scotty 660 // logs 661 ScottyAgentUserId int64 `json:"scottyAgentUserId,omitempty,string"` 662 // ScottyCustomerLog: Customer-specific data to be recorded in the Scotty logs 663 // type is logs_proto_scotty.CustomerLog 664 ScottyCustomerLog string `json:"scottyCustomerLog,omitempty"` 665 // TrafficClassField: Specifies the TrafficClass that Scotty should use for any 666 // RPCs to fetch the response bytes. Will override the traffic class GTOS of 667 // the incoming http request. This is a temporary field to facilitate 668 // whitelisting and experimentation by the bigstore agent only. For instance, 669 // this does not apply to RTMP reads. WARNING: DO NOT USE WITHOUT PERMISSION 670 // FROM THE SCOTTY TEAM. 671 // 672 // Possible values: 673 // "BE1" - Application-selectable traffic classes Best effort 674 // "AF1" - Assured forwarding priority 1 675 // "AF2" - Assured forwarding priority 2 676 // "AF3" - Assured forwarding priority 3 677 // "AF4" - Assured forwarding priority 4 678 // "NC1" - Network control 679 // "NC0" - Network control 680 // "BE0" - Best effort at high packet loss 681 // "LLQ" - Low-latency queue (LLQ) best effort (go/llq) 682 // "LLQ1" - LLQ best effort (go/llq2) 683 // "LLQ2" - LLQ assured forwarding priority 2 (go/llq2) 684 TrafficClassField string `json:"trafficClassField,omitempty"` 685 // VerifyHashFromHeader: Tells Scotty to verify hashes on the agent's behalf by 686 // parsing out the X-Goog-Hash header. 687 VerifyHashFromHeader bool `json:"verifyHashFromHeader,omitempty"` 688 // ForceSendFields is a list of field names (e.g. "CustomData") to 689 // unconditionally include in API requests. By default, fields with empty or 690 // default values are omitted from API requests. See 691 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 692 // details. 693 ForceSendFields []string `json:"-"` 694 // NullFields is a list of field names (e.g. "CustomData") to include in API 695 // requests with the JSON null value. By default, fields with empty values are 696 // omitted from API requests. See 697 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 698 NullFields []string `json:"-"` 699 } 700 701 func (s *MediaResponseInfo) MarshalJSON() ([]byte, error) { 702 type NoMethod MediaResponseInfo 703 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 704 } 705 706 // OffsetPosition: Offset Position. 707 type OffsetPosition struct { 708 // Left: Offset distance from left side of an asset or a window. 709 Left int64 `json:"left,omitempty"` 710 // Top: Offset distance from top side of an asset or a window. 711 Top int64 `json:"top,omitempty"` 712 // ForceSendFields is a list of field names (e.g. "Left") to unconditionally 713 // include in API requests. By default, fields with empty or default values are 714 // omitted from API requests. See 715 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 716 // details. 717 ForceSendFields []string `json:"-"` 718 // NullFields is a list of field names (e.g. "Left") to include in API requests 719 // with the JSON null value. By default, fields with empty values are omitted 720 // from API requests. See 721 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 722 NullFields []string `json:"-"` 723 } 724 725 func (s *OffsetPosition) MarshalJSON() ([]byte, error) { 726 type NoMethod OffsetPosition 727 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 728 } 729 730 // PopupWindowProperties: Popup Window Properties. 731 type PopupWindowProperties struct { 732 // Dimension: Popup dimension for a creative. This is a read-only field. 733 // Applicable to the following creative types: all RICH_MEDIA and all VPAID 734 Dimension *Size `json:"dimension,omitempty"` 735 // Offset: Upper-left corner coordinates of the popup window. Applicable if 736 // positionType is COORDINATES. 737 Offset *OffsetPosition `json:"offset,omitempty"` 738 // PositionType: Popup window position either centered or at specific 739 // coordinate. 740 // 741 // Possible values: 742 // "CENTER" 743 // "COORDINATES" 744 PositionType string `json:"positionType,omitempty"` 745 // ShowAddressBar: Whether to display the browser address bar. 746 ShowAddressBar bool `json:"showAddressBar,omitempty"` 747 // ShowMenuBar: Whether to display the browser menu bar. 748 ShowMenuBar bool `json:"showMenuBar,omitempty"` 749 // ShowScrollBar: Whether to display the browser scroll bar. 750 ShowScrollBar bool `json:"showScrollBar,omitempty"` 751 // ShowStatusBar: Whether to display the browser status bar. 752 ShowStatusBar bool `json:"showStatusBar,omitempty"` 753 // ShowToolBar: Whether to display the browser tool bar. 754 ShowToolBar bool `json:"showToolBar,omitempty"` 755 // Title: Title of popup window. 756 Title string `json:"title,omitempty"` 757 // ForceSendFields is a list of field names (e.g. "Dimension") to 758 // unconditionally include in API requests. By default, fields with empty or 759 // default values are omitted from API requests. See 760 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 761 // details. 762 ForceSendFields []string `json:"-"` 763 // NullFields is a list of field names (e.g. "Dimension") to include in API 764 // requests with the JSON null value. By default, fields with empty values are 765 // omitted from API requests. See 766 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 767 NullFields []string `json:"-"` 768 } 769 770 func (s *PopupWindowProperties) MarshalJSON() ([]byte, error) { 771 type NoMethod PopupWindowProperties 772 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 773 } 774 775 // Size: Represents the dimensions of ads, placements, creatives, or creative 776 // assets. 777 type Size struct { 778 // Height: Height of this size. Acceptable values are 0 to 32767, inclusive. 779 Height int64 `json:"height,omitempty"` 780 // Iab: IAB standard size. This is a read-only, auto-generated field. 781 Iab bool `json:"iab,omitempty"` 782 // Id: ID of this size. This is a read-only, auto-generated field. 783 Id int64 `json:"id,omitempty,string"` 784 // Kind: Identifies what kind of resource this is. Value: the fixed string 785 // "dfareporting#size". 786 Kind string `json:"kind,omitempty"` 787 // Width: Width of this size. Acceptable values are 0 to 32767, inclusive. 788 Width int64 `json:"width,omitempty"` 789 // ForceSendFields is a list of field names (e.g. "Height") to unconditionally 790 // include in API requests. By default, fields with empty or default values are 791 // omitted from API requests. See 792 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 793 // details. 794 ForceSendFields []string `json:"-"` 795 // NullFields is a list of field names (e.g. "Height") to include in API 796 // requests with the JSON null value. By default, fields with empty values are 797 // omitted from API requests. See 798 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 799 NullFields []string `json:"-"` 800 } 801 802 func (s *Size) MarshalJSON() ([]byte, error) { 803 type NoMethod Size 804 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 805 } 806 807 type MediaUploadCall struct { 808 s *Service 809 profileId int64 810 advertiserId int64 811 creativeassetmetadata *CreativeAssetMetadata 812 urlParams_ gensupport.URLParams 813 mediaInfo_ *gensupport.MediaInfo 814 ctx_ context.Context 815 header_ http.Header 816 } 817 818 // Upload: Inserts a new creative asset. 819 // 820 // - advertiserId: Advertiser ID of this creative. This is a required field. 821 // - profileId: User profile ID associated with this request. 822 func (r *MediaService) Upload(profileId int64, advertiserId int64, creativeassetmetadata *CreativeAssetMetadata) *MediaUploadCall { 823 c := &MediaUploadCall{s: r.s, urlParams_: make(gensupport.URLParams)} 824 c.profileId = profileId 825 c.advertiserId = advertiserId 826 c.creativeassetmetadata = creativeassetmetadata 827 return c 828 } 829 830 // Media specifies the media to upload in one or more chunks. The chunk size 831 // may be controlled by supplying a MediaOption generated by 832 // googleapi.ChunkSize. The chunk size defaults to 833 // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload 834 // request will be determined by sniffing the contents of r, unless a 835 // MediaOption generated by googleapi.ContentType is supplied. 836 // At most one of Media and ResumableMedia may be set. 837 func (c *MediaUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *MediaUploadCall { 838 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 839 return c 840 } 841 842 // ResumableMedia specifies the media to upload in chunks and can be canceled 843 // with ctx. 844 // 845 // Deprecated: use Media instead. 846 // 847 // At most one of Media and ResumableMedia may be set. mediaType identifies the 848 // MIME media type of the upload, such as "image/png". If mediaType is "", it 849 // will be auto-detected. The provided ctx will supersede any context 850 // previously provided to the Context method. 851 func (c *MediaUploadCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *MediaUploadCall { 852 c.ctx_ = ctx 853 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 854 return c 855 } 856 857 // ProgressUpdater provides a callback function that will be called after every 858 // chunk. It should be a low-latency function in order to not slow down the 859 // upload operation. This should only be called when using ResumableMedia (as 860 // opposed to Media). 861 func (c *MediaUploadCall) ProgressUpdater(pu googleapi.ProgressUpdater) *MediaUploadCall { 862 c.mediaInfo_.SetProgressUpdater(pu) 863 return c 864 } 865 866 // Fields allows partial responses to be retrieved. See 867 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 868 // details. 869 func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall { 870 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 871 return c 872 } 873 874 // Context sets the context to be used in this call's Do method. 875 // This context will supersede any context previously provided to the 876 // ResumableMedia method. 877 func (c *MediaUploadCall) Context(ctx context.Context) *MediaUploadCall { 878 c.ctx_ = ctx 879 return c 880 } 881 882 // Header returns a http.Header that can be modified by the caller to add 883 // headers to the request. 884 func (c *MediaUploadCall) Header() http.Header { 885 if c.header_ == nil { 886 c.header_ = make(http.Header) 887 } 888 return c.header_ 889 } 890 891 func (c *MediaUploadCall) doRequest(alt string) (*http.Response, error) { 892 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 893 var body io.Reader = nil 894 body, err := googleapi.WithoutDataWrapper.JSONReader(c.creativeassetmetadata) 895 if err != nil { 896 return nil, err 897 } 898 c.urlParams_.Set("alt", alt) 899 c.urlParams_.Set("prettyPrint", "false") 900 urls := googleapi.ResolveRelative(c.s.BasePath, "userprofiles/{+profileId}/creativeAssets/{+advertiserId}/creativeAssets") 901 if c.mediaInfo_ != nil { 902 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/dfareporting/v3.5/userprofiles/{+profileId}/creativeAssets/{+advertiserId}/creativeAssets") 903 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 904 } 905 if body == nil { 906 body = new(bytes.Buffer) 907 reqHeaders.Set("Content-Type", "application/json") 908 } 909 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 910 defer cleanup() 911 urls += "?" + c.urlParams_.Encode() 912 req, err := http.NewRequest("POST", urls, body) 913 if err != nil { 914 return nil, err 915 } 916 req.Header = reqHeaders 917 req.GetBody = getBody 918 googleapi.Expand(req.URL, map[string]string{ 919 "profileId": strconv.FormatInt(c.profileId, 10), 920 "advertiserId": strconv.FormatInt(c.advertiserId, 10), 921 }) 922 return gensupport.SendRequest(c.ctx_, c.s.client, req) 923 } 924 925 // Do executes the "dfareporting.media.upload" call. 926 // Any non-2xx status code is an error. Response headers are in either 927 // *CreativeAssetMetadata.ServerResponse.Header or (if a response was returned 928 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 929 // check whether the returned error was because http.StatusNotModified was 930 // returned. 931 func (c *MediaUploadCall) Do(opts ...googleapi.CallOption) (*CreativeAssetMetadata, error) { 932 gensupport.SetOptions(c.urlParams_, opts...) 933 res, err := c.doRequest("json") 934 if res != nil && res.StatusCode == http.StatusNotModified { 935 if res.Body != nil { 936 res.Body.Close() 937 } 938 return nil, gensupport.WrapError(&googleapi.Error{ 939 Code: res.StatusCode, 940 Header: res.Header, 941 }) 942 } 943 if err != nil { 944 return nil, err 945 } 946 defer googleapi.CloseBody(res) 947 if err := googleapi.CheckResponse(res); err != nil { 948 return nil, gensupport.WrapError(err) 949 } 950 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 951 if rx != nil { 952 rx.Client = c.s.client 953 rx.UserAgent = c.s.userAgent() 954 ctx := c.ctx_ 955 if ctx == nil { 956 ctx = context.TODO() 957 } 958 res, err = rx.Upload(ctx) 959 if err != nil { 960 return nil, err 961 } 962 defer res.Body.Close() 963 if err := googleapi.CheckResponse(res); err != nil { 964 return nil, gensupport.WrapError(err) 965 } 966 } 967 ret := &CreativeAssetMetadata{ 968 ServerResponse: googleapi.ServerResponse{ 969 Header: res.Header, 970 HTTPStatusCode: res.StatusCode, 971 }, 972 } 973 target := &ret 974 if err := gensupport.DecodeResponse(target, res); err != nil { 975 return nil, err 976 } 977 return ret, nil 978 } 979