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 cloudsupport provides access to the Google Cloud Support API. 8 // 9 // For product documentation, see: https://cloud.google.com/support/docs/apis 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/cloudsupport/v2beta" 27 // ... 28 // ctx := context.Background() 29 // cloudsupportService, err := cloudsupport.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 // cloudsupportService, err := cloudsupport.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 // cloudsupportService, err := cloudsupport.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package cloudsupport // import "google.golang.org/api/cloudsupport/v2beta" 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 = "cloudsupport:v2beta" 90 const apiName = "cloudsupport" 91 const apiVersion = "v2beta" 92 const basePath = "https://cloudsupport.googleapis.com/" 93 const basePathTemplate = "https://cloudsupport.UNIVERSE_DOMAIN/" 94 const mtlsBasePath = "https://cloudsupport.mtls.googleapis.com/" 95 96 // OAuth2 scopes used by this API. 97 const ( 98 // See, edit, configure, and delete your Google Cloud data and see the email 99 // address for your Google Account. 100 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 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/cloud-platform", 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.CaseClassifications = NewCaseClassificationsService(s) 139 s.Cases = NewCasesService(s) 140 s.Media = NewMediaService(s) 141 return s, nil 142 } 143 144 type Service struct { 145 client *http.Client 146 BasePath string // API endpoint base URL 147 UserAgent string // optional additional User-Agent fragment 148 149 CaseClassifications *CaseClassificationsService 150 151 Cases *CasesService 152 153 Media *MediaService 154 } 155 156 func (s *Service) userAgent() string { 157 if s.UserAgent == "" { 158 return googleapi.UserAgent 159 } 160 return googleapi.UserAgent + " " + s.UserAgent 161 } 162 163 func NewCaseClassificationsService(s *Service) *CaseClassificationsService { 164 rs := &CaseClassificationsService{s: s} 165 return rs 166 } 167 168 type CaseClassificationsService struct { 169 s *Service 170 } 171 172 func NewCasesService(s *Service) *CasesService { 173 rs := &CasesService{s: s} 174 rs.Attachments = NewCasesAttachmentsService(s) 175 rs.Comments = NewCasesCommentsService(s) 176 return rs 177 } 178 179 type CasesService struct { 180 s *Service 181 182 Attachments *CasesAttachmentsService 183 184 Comments *CasesCommentsService 185 } 186 187 func NewCasesAttachmentsService(s *Service) *CasesAttachmentsService { 188 rs := &CasesAttachmentsService{s: s} 189 return rs 190 } 191 192 type CasesAttachmentsService struct { 193 s *Service 194 } 195 196 func NewCasesCommentsService(s *Service) *CasesCommentsService { 197 rs := &CasesCommentsService{s: s} 198 return rs 199 } 200 201 type CasesCommentsService struct { 202 s *Service 203 } 204 205 func NewMediaService(s *Service) *MediaService { 206 rs := &MediaService{s: s} 207 return rs 208 } 209 210 type MediaService struct { 211 s *Service 212 } 213 214 // Actor: An Actor represents an entity that performed an action. For example, 215 // an actor could be a user who posted a comment on a support case, a user who 216 // uploaded an attachment, or a service account that created a support case. 217 type Actor struct { 218 // DisplayName: The name to display for the actor. If not provided, it is 219 // inferred from credentials supplied during case creation. When an email is 220 // provided, a display name must also be provided. This will be obfuscated if 221 // the user is a Google Support agent. 222 DisplayName string `json:"displayName,omitempty"` 223 // Email: The email address of the actor. If not provided, it is inferred from 224 // the credentials supplied during case creation. When a name is provided, an 225 // email must also be provided. If the user is a Google Support agent, this is 226 // obfuscated. This field is deprecated. Use **username** field instead. 227 Email string `json:"email,omitempty"` 228 // GoogleSupport: Output only. Whether the actor is a Google support actor. 229 GoogleSupport bool `json:"googleSupport,omitempty"` 230 // Username: Output only. The username of the actor. It may look like an email 231 // or other format provided by the identity provider. If not provided, it is 232 // inferred from the credentials supplied. When a name is provided, a username 233 // must also be provided. If the user is a Google Support agent, this will not 234 // be set. 235 Username string `json:"username,omitempty"` 236 // ForceSendFields is a list of field names (e.g. "DisplayName") to 237 // unconditionally include in API requests. By default, fields with empty or 238 // default values are omitted from API requests. See 239 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 240 // details. 241 ForceSendFields []string `json:"-"` 242 // NullFields is a list of field names (e.g. "DisplayName") to include in API 243 // requests with the JSON null value. By default, fields with empty values are 244 // omitted from API requests. See 245 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 246 NullFields []string `json:"-"` 247 } 248 249 func (s *Actor) MarshalJSON() ([]byte, error) { 250 type NoMethod Actor 251 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 252 } 253 254 // Attachment: An Attachment contains metadata about a file that was uploaded 255 // to a case - it is NOT a file itself. That being said, the name of an 256 // Attachment object can be used to download its accompanying file through the 257 // `media.download` endpoint. While attachments can be uploaded in the console 258 // at the same time as a comment, they're associated on a "case" level, not a 259 // "comment" level. 260 type Attachment struct { 261 // CreateTime: Output only. The time at which the attachment was created. 262 CreateTime string `json:"createTime,omitempty"` 263 // Creator: Output only. The user who uploaded the attachment. Note, the name 264 // and email will be obfuscated if the attachment was uploaded by Google 265 // support. 266 Creator *Actor `json:"creator,omitempty"` 267 // Filename: The filename of the attachment (e.g. "graph.jpg"). 268 Filename string `json:"filename,omitempty"` 269 // MimeType: Output only. The MIME type of the attachment (e.g. text/plain). 270 MimeType string `json:"mimeType,omitempty"` 271 // Name: Output only. The resource name of the attachment. 272 Name string `json:"name,omitempty"` 273 // SizeBytes: Output only. The size of the attachment in bytes. 274 SizeBytes int64 `json:"sizeBytes,omitempty,string"` 275 276 // ServerResponse contains the HTTP response code and headers from the server. 277 googleapi.ServerResponse `json:"-"` 278 // ForceSendFields is a list of field names (e.g. "CreateTime") to 279 // unconditionally include in API requests. By default, fields with empty or 280 // default values are omitted from API requests. See 281 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 282 // details. 283 ForceSendFields []string `json:"-"` 284 // NullFields is a list of field names (e.g. "CreateTime") to include in API 285 // requests with the JSON null value. By default, fields with empty values are 286 // omitted from API requests. See 287 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 288 NullFields []string `json:"-"` 289 } 290 291 func (s *Attachment) MarshalJSON() ([]byte, error) { 292 type NoMethod Attachment 293 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 294 } 295 296 // Blobstore2Info: # gdata.* are outside protos with mising documentation 297 type Blobstore2Info struct { 298 // BlobGeneration: # gdata.* are outside protos with mising documentation 299 BlobGeneration int64 `json:"blobGeneration,omitempty,string"` 300 // BlobId: # gdata.* are outside protos with mising documentation 301 BlobId string `json:"blobId,omitempty"` 302 // DownloadReadHandle: # gdata.* are outside protos with mising documentation 303 DownloadReadHandle string `json:"downloadReadHandle,omitempty"` 304 // ReadToken: # gdata.* are outside protos with mising documentation 305 ReadToken string `json:"readToken,omitempty"` 306 // UploadMetadataContainer: # gdata.* are outside protos with mising 307 // documentation 308 UploadMetadataContainer string `json:"uploadMetadataContainer,omitempty"` 309 // ForceSendFields is a list of field names (e.g. "BlobGeneration") to 310 // unconditionally include in API requests. By default, fields with empty or 311 // default values are omitted from API requests. See 312 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 313 // details. 314 ForceSendFields []string `json:"-"` 315 // NullFields is a list of field names (e.g. "BlobGeneration") to include in 316 // API requests with the JSON null value. By default, fields with empty values 317 // are omitted from API requests. See 318 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 319 NullFields []string `json:"-"` 320 } 321 322 func (s *Blobstore2Info) MarshalJSON() ([]byte, error) { 323 type NoMethod Blobstore2Info 324 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 325 } 326 327 // Case: A Case is an object that contains the details of a support case. It 328 // contains fields for the time it was created, its priority, its 329 // classification, and more. Cases can also have comments and attachments that 330 // get added over time. A case is parented by a Google Cloud organization or 331 // project. Organizations are identified by a number, so the name of a case 332 // parented by an organization would look like this: ``` 333 // organizations/123/cases/456 ``` Projects have two unique identifiers, an ID 334 // and a number, and they look like this: ``` projects/abc/cases/456 ``` ``` 335 // projects/123/cases/456 ``` You can use either of them when calling the API. 336 // To learn more about project identifiers, see AIP-2510 337 // (https://google.aip.dev/cloud/2510). 338 type Case struct { 339 // Classification: The issue classification applicable to this case. 340 Classification *CaseClassification `json:"classification,omitempty"` 341 // ContactEmail: A user-supplied email address to send case update 342 // notifications for. This should only be used in BYOID flows, where we cannot 343 // infer the user's email address directly from their EUCs. 344 ContactEmail string `json:"contactEmail,omitempty"` 345 // CreateTime: Output only. The time this case was created. 346 CreateTime string `json:"createTime,omitempty"` 347 // Creator: The user who created the case. Note: The name and email will be 348 // obfuscated if the case was created by Google Support. 349 Creator *Actor `json:"creator,omitempty"` 350 // Description: A broad description of the issue. 351 Description string `json:"description,omitempty"` 352 // DisplayName: The short summary of the issue reported in this case. 353 DisplayName string `json:"displayName,omitempty"` 354 // Escalated: Whether the case is currently escalated. 355 Escalated bool `json:"escalated,omitempty"` 356 // LanguageCode: The language the user has requested to receive support in. 357 // This should be a BCP 47 language code (e.g., "en", "zh-CN", "zh-TW", 358 // "ja", "ko"). If no language or an unsupported language is specified, 359 // this field defaults to English (en). Language selection during case creation 360 // may affect your available support options. For a list of supported languages 361 // and their support working hours, see: 362 // https://cloud.google.com/support/docs/language-working-hours 363 LanguageCode string `json:"languageCode,omitempty"` 364 // Name: The resource name for the case. 365 Name string `json:"name,omitempty"` 366 // Priority: The priority of this case. 367 // 368 // Possible values: 369 // "PRIORITY_UNSPECIFIED" - Priority is undefined or has not been set yet. 370 // "P0" - Extreme impact on a production service. Service is hard down. 371 // "P1" - Critical impact on a production service. Service is currently 372 // unusable. 373 // "P2" - Severe impact on a production service. Service is usable but 374 // greatly impaired. 375 // "P3" - Medium impact on a production service. Service is available, but 376 // moderately impaired. 377 // "P4" - General questions or minor issues. Production service is fully 378 // available. 379 Priority string `json:"priority,omitempty"` 380 // Severity: REMOVED. The severity of this case. Use priority instead. 381 // 382 // Possible values: 383 // "SEVERITY_UNSPECIFIED" - Severity is undefined or has not been set yet. 384 // "S0" - Extreme impact on a production service. Service is hard down. 385 // "S1" - Critical impact on a production service. Service is currently 386 // unusable. 387 // "S2" - Severe impact on a production service. Service is usable but 388 // greatly impaired. 389 // "S3" - Medium impact on a production service. Service is available, but 390 // moderately impaired. 391 // "S4" - General questions or minor issues. Production service is fully 392 // available. 393 Severity string `json:"severity,omitempty"` 394 // State: Output only. The current status of the support case. 395 // 396 // Possible values: 397 // "STATE_UNSPECIFIED" - Case is in an unknown state. 398 // "NEW" - The case has been created but no one is assigned to work on it 399 // yet. 400 // "IN_PROGRESS_GOOGLE_SUPPORT" - The case is currently being handled by 401 // Google support. 402 // "ACTION_REQUIRED" - Google is waiting for a response. 403 // "SOLUTION_PROVIDED" - A solution has been offered for the case, but it 404 // isn't yet closed. 405 // "CLOSED" - The case has been resolved. 406 State string `json:"state,omitempty"` 407 // SubscriberEmailAddresses: The email addresses to receive updates on this 408 // case. 409 SubscriberEmailAddresses []string `json:"subscriberEmailAddresses,omitempty"` 410 // TestCase: Whether this case was created for internal API testing and should 411 // not be acted on by the support team. 412 TestCase bool `json:"testCase,omitempty"` 413 // TimeZone: The timezone of the user who created the support case. It should 414 // be in a format IANA recognizes: https://www.iana.org/time-zones. There is no 415 // additional validation done by the API. 416 TimeZone string `json:"timeZone,omitempty"` 417 // UpdateTime: Output only. The time this case was last updated. 418 UpdateTime string `json:"updateTime,omitempty"` 419 420 // ServerResponse contains the HTTP response code and headers from the server. 421 googleapi.ServerResponse `json:"-"` 422 // ForceSendFields is a list of field names (e.g. "Classification") to 423 // unconditionally include in API requests. By default, fields with empty or 424 // default values are omitted from API requests. See 425 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 426 // details. 427 ForceSendFields []string `json:"-"` 428 // NullFields is a list of field names (e.g. "Classification") to include in 429 // API requests with the JSON null value. By default, fields with empty values 430 // are omitted from API requests. See 431 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 432 NullFields []string `json:"-"` 433 } 434 435 func (s *Case) MarshalJSON() ([]byte, error) { 436 type NoMethod Case 437 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 438 } 439 440 // CaseClassification: A Case Classification represents the topic that a case 441 // is about. It's very important to use accurate classifications, because 442 // they're used to route your cases to specialists who can help you. A 443 // classification always has an ID that is its unique identifier. A valid ID is 444 // required when creating a case. 445 type CaseClassification struct { 446 // DisplayName: A display name for the classification. The display name is not 447 // static and can change. To uniquely and consistently identify 448 // classifications, use the `CaseClassification.id` field. 449 DisplayName string `json:"displayName,omitempty"` 450 // Id: The unique ID for a classification. Must be specified for case creation. 451 // To retrieve valid classification IDs for case creation, use 452 // `caseClassifications.search`. Classification IDs returned by 453 // `caseClassifications.search` are guaranteed to be valid for at least 6 454 // months. If a given classification is deactiveated, it will immediately stop 455 // being returned. After 6 months, `case.create` requests using the 456 // classification ID will fail. 457 Id string `json:"id,omitempty"` 458 // Product: The full product the classification corresponds to. 459 Product *Product `json:"product,omitempty"` 460 // ForceSendFields is a list of field names (e.g. "DisplayName") to 461 // unconditionally include in API requests. By default, fields with empty or 462 // default values are omitted from API requests. See 463 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 464 // details. 465 ForceSendFields []string `json:"-"` 466 // NullFields is a list of field names (e.g. "DisplayName") to include in API 467 // requests with the JSON null value. By default, fields with empty values are 468 // omitted from API requests. See 469 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 470 NullFields []string `json:"-"` 471 } 472 473 func (s *CaseClassification) MarshalJSON() ([]byte, error) { 474 type NoMethod CaseClassification 475 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 476 } 477 478 // CloseCaseRequest: The request message for the CloseCase endpoint. 479 type CloseCaseRequest struct { 480 } 481 482 // Comment: A comment associated with a support case. Case comments are the 483 // primary way for Google Support to communicate with a user who has opened a 484 // case. When a user responds to Google Support, the user's responses also 485 // appear as comments. 486 type Comment struct { 487 // Body: The full comment body. Maximum of 12800 characters. 488 Body string `json:"body,omitempty"` 489 // CreateTime: Output only. The time when the comment was created. 490 CreateTime string `json:"createTime,omitempty"` 491 // Creator: Output only. The user or Google Support agent who created the 492 // comment. 493 Creator *Actor `json:"creator,omitempty"` 494 // Name: Output only. Identifier. The resource name of the comment. 495 Name string `json:"name,omitempty"` 496 // PlainTextBody: Output only. DEPRECATED. DO NOT USE. A duplicate of the 497 // `body` field. This field is only present for legacy reasons. 498 PlainTextBody string `json:"plainTextBody,omitempty"` 499 500 // ServerResponse contains the HTTP response code and headers from the server. 501 googleapi.ServerResponse `json:"-"` 502 // ForceSendFields is a list of field names (e.g. "Body") to unconditionally 503 // include in API requests. By default, fields with empty or default values are 504 // omitted from API requests. See 505 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 506 // details. 507 ForceSendFields []string `json:"-"` 508 // NullFields is a list of field names (e.g. "Body") to include in API requests 509 // with the JSON null value. By default, fields with empty values are omitted 510 // from API requests. See 511 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 512 NullFields []string `json:"-"` 513 } 514 515 func (s *Comment) MarshalJSON() ([]byte, error) { 516 type NoMethod Comment 517 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 518 } 519 520 // CompositeMedia: # gdata.* are outside protos with mising documentation 521 type CompositeMedia struct { 522 // BlobRef: # gdata.* are outside protos with mising documentation 523 BlobRef string `json:"blobRef,omitempty"` 524 // Blobstore2Info: # gdata.* are outside protos with mising documentation 525 Blobstore2Info *Blobstore2Info `json:"blobstore2Info,omitempty"` 526 // CosmoBinaryReference: # gdata.* are outside protos with mising documentation 527 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"` 528 // Crc32cHash: # gdata.* are outside protos with mising documentation 529 Crc32cHash int64 `json:"crc32cHash,omitempty"` 530 // Inline: # gdata.* are outside protos with mising documentation 531 Inline string `json:"inline,omitempty"` 532 // Length: # gdata.* are outside protos with mising documentation 533 Length int64 `json:"length,omitempty,string"` 534 // Md5Hash: # gdata.* are outside protos with mising documentation 535 Md5Hash string `json:"md5Hash,omitempty"` 536 // ObjectId: # gdata.* are outside protos with mising documentation 537 ObjectId *ObjectId `json:"objectId,omitempty"` 538 // Path: # gdata.* are outside protos with mising documentation 539 Path string `json:"path,omitempty"` 540 // ReferenceType: # gdata.* are outside protos with mising documentation 541 // 542 // Possible values: 543 // "PATH" - # gdata.* are outside protos with mising documentation 544 // "BLOB_REF" - # gdata.* are outside protos with mising documentation 545 // "INLINE" - # gdata.* are outside protos with mising documentation 546 // "BIGSTORE_REF" - # gdata.* are outside protos with mising documentation 547 // "COSMO_BINARY_REFERENCE" - # gdata.* are outside protos with mising 548 // documentation 549 ReferenceType string `json:"referenceType,omitempty"` 550 // Sha1Hash: # gdata.* are outside protos with mising documentation 551 Sha1Hash string `json:"sha1Hash,omitempty"` 552 // ForceSendFields is a list of field names (e.g. "BlobRef") to unconditionally 553 // include in API requests. By default, fields with empty or default values are 554 // omitted from API requests. See 555 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 556 // details. 557 ForceSendFields []string `json:"-"` 558 // NullFields is a list of field names (e.g. "BlobRef") to include in API 559 // requests with the JSON null value. By default, fields with empty values are 560 // omitted from API requests. See 561 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 562 NullFields []string `json:"-"` 563 } 564 565 func (s *CompositeMedia) MarshalJSON() ([]byte, error) { 566 type NoMethod CompositeMedia 567 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 568 } 569 570 // ContentTypeInfo: # gdata.* are outside protos with mising documentation 571 type ContentTypeInfo struct { 572 // BestGuess: # gdata.* are outside protos with mising documentation 573 BestGuess string `json:"bestGuess,omitempty"` 574 // FromBytes: # gdata.* are outside protos with mising documentation 575 FromBytes string `json:"fromBytes,omitempty"` 576 // FromFileName: # gdata.* are outside protos with mising documentation 577 FromFileName string `json:"fromFileName,omitempty"` 578 // FromHeader: # gdata.* are outside protos with mising documentation 579 FromHeader string `json:"fromHeader,omitempty"` 580 // FromUrlPath: # gdata.* are outside protos with mising documentation 581 FromUrlPath string `json:"fromUrlPath,omitempty"` 582 // ForceSendFields is a list of field names (e.g. "BestGuess") to 583 // unconditionally include in API requests. By default, fields with empty or 584 // default values are omitted from API requests. See 585 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 586 // details. 587 ForceSendFields []string `json:"-"` 588 // NullFields is a list of field names (e.g. "BestGuess") to include in API 589 // requests with the JSON null value. By default, fields with empty values are 590 // omitted from API requests. See 591 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 592 NullFields []string `json:"-"` 593 } 594 595 func (s *ContentTypeInfo) MarshalJSON() ([]byte, error) { 596 type NoMethod ContentTypeInfo 597 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 598 } 599 600 // CreateAttachmentRequest: The request message for the CreateAttachment 601 // endpoint. 602 type CreateAttachmentRequest struct { 603 // Attachment: Required. The attachment to be created. 604 Attachment *Attachment `json:"attachment,omitempty"` 605 // ForceSendFields is a list of field names (e.g. "Attachment") to 606 // unconditionally include in API requests. By default, fields with empty or 607 // default values are omitted from API requests. See 608 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 609 // details. 610 ForceSendFields []string `json:"-"` 611 // NullFields is a list of field names (e.g. "Attachment") to include in API 612 // requests with the JSON null value. By default, fields with empty values are 613 // omitted from API requests. See 614 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 615 NullFields []string `json:"-"` 616 } 617 618 func (s *CreateAttachmentRequest) MarshalJSON() ([]byte, error) { 619 type NoMethod CreateAttachmentRequest 620 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 621 } 622 623 // DiffChecksumsResponse: # gdata.* are outside protos with mising 624 // documentation 625 type DiffChecksumsResponse struct { 626 // ChecksumsLocation: # gdata.* are outside protos with mising documentation 627 ChecksumsLocation *CompositeMedia `json:"checksumsLocation,omitempty"` 628 // ChunkSizeBytes: # gdata.* are outside protos with mising documentation 629 ChunkSizeBytes int64 `json:"chunkSizeBytes,omitempty,string"` 630 // ObjectLocation: # gdata.* are outside protos with mising documentation 631 ObjectLocation *CompositeMedia `json:"objectLocation,omitempty"` 632 // ObjectSizeBytes: # gdata.* are outside protos with mising documentation 633 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"` 634 // ObjectVersion: # gdata.* are outside protos with mising documentation 635 ObjectVersion string `json:"objectVersion,omitempty"` 636 // ForceSendFields is a list of field names (e.g. "ChecksumsLocation") to 637 // unconditionally include in API requests. By default, fields with empty or 638 // default values are omitted from API requests. See 639 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 640 // details. 641 ForceSendFields []string `json:"-"` 642 // NullFields is a list of field names (e.g. "ChecksumsLocation") to include in 643 // API requests with the JSON null value. By default, fields with empty values 644 // are omitted from API requests. See 645 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 646 NullFields []string `json:"-"` 647 } 648 649 func (s *DiffChecksumsResponse) MarshalJSON() ([]byte, error) { 650 type NoMethod DiffChecksumsResponse 651 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 652 } 653 654 // DiffDownloadResponse: # gdata.* are outside protos with mising documentation 655 type DiffDownloadResponse struct { 656 // ObjectLocation: # gdata.* are outside protos with mising documentation 657 ObjectLocation *CompositeMedia `json:"objectLocation,omitempty"` 658 // ForceSendFields is a list of field names (e.g. "ObjectLocation") to 659 // unconditionally include in API requests. By default, fields with empty or 660 // default values are omitted from API requests. See 661 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 662 // details. 663 ForceSendFields []string `json:"-"` 664 // NullFields is a list of field names (e.g. "ObjectLocation") to include in 665 // API requests with the JSON null value. By default, fields with empty values 666 // are omitted from API requests. See 667 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 668 NullFields []string `json:"-"` 669 } 670 671 func (s *DiffDownloadResponse) MarshalJSON() ([]byte, error) { 672 type NoMethod DiffDownloadResponse 673 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 674 } 675 676 // DiffUploadRequest: # gdata.* are outside protos with mising documentation 677 type DiffUploadRequest struct { 678 // ChecksumsInfo: # gdata.* are outside protos with mising documentation 679 ChecksumsInfo *CompositeMedia `json:"checksumsInfo,omitempty"` 680 // ObjectInfo: # gdata.* are outside protos with mising documentation 681 ObjectInfo *CompositeMedia `json:"objectInfo,omitempty"` 682 // ObjectVersion: # gdata.* are outside protos with mising documentation 683 ObjectVersion string `json:"objectVersion,omitempty"` 684 // ForceSendFields is a list of field names (e.g. "ChecksumsInfo") to 685 // unconditionally include in API requests. By default, fields with empty or 686 // default values are omitted from API requests. See 687 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 688 // details. 689 ForceSendFields []string `json:"-"` 690 // NullFields is a list of field names (e.g. "ChecksumsInfo") to include in API 691 // requests with the JSON null value. By default, fields with empty values are 692 // omitted from API requests. See 693 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 694 NullFields []string `json:"-"` 695 } 696 697 func (s *DiffUploadRequest) MarshalJSON() ([]byte, error) { 698 type NoMethod DiffUploadRequest 699 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 700 } 701 702 // DiffUploadResponse: # gdata.* are outside protos with mising documentation 703 type DiffUploadResponse struct { 704 // ObjectVersion: # gdata.* are outside protos with mising documentation 705 ObjectVersion string `json:"objectVersion,omitempty"` 706 // OriginalObject: # gdata.* are outside protos with mising documentation 707 OriginalObject *CompositeMedia `json:"originalObject,omitempty"` 708 // ForceSendFields is a list of field names (e.g. "ObjectVersion") to 709 // unconditionally include in API requests. By default, fields with empty or 710 // default values are omitted from API requests. See 711 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 712 // details. 713 ForceSendFields []string `json:"-"` 714 // NullFields is a list of field names (e.g. "ObjectVersion") to include in API 715 // requests with the JSON null value. By default, fields with empty values are 716 // omitted from API requests. See 717 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 718 NullFields []string `json:"-"` 719 } 720 721 func (s *DiffUploadResponse) MarshalJSON() ([]byte, error) { 722 type NoMethod DiffUploadResponse 723 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 724 } 725 726 // DiffVersionResponse: # gdata.* are outside protos with mising documentation 727 type DiffVersionResponse struct { 728 // ObjectSizeBytes: # gdata.* are outside protos with mising documentation 729 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"` 730 // ObjectVersion: # gdata.* are outside protos with mising documentation 731 ObjectVersion string `json:"objectVersion,omitempty"` 732 // ForceSendFields is a list of field names (e.g. "ObjectSizeBytes") to 733 // unconditionally include in API requests. By default, fields with empty or 734 // default values are omitted from API requests. See 735 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 736 // details. 737 ForceSendFields []string `json:"-"` 738 // NullFields is a list of field names (e.g. "ObjectSizeBytes") to include in 739 // API requests with the JSON null value. By default, fields with empty values 740 // are omitted from API requests. See 741 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 742 NullFields []string `json:"-"` 743 } 744 745 func (s *DiffVersionResponse) MarshalJSON() ([]byte, error) { 746 type NoMethod DiffVersionResponse 747 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 748 } 749 750 // DownloadParameters: # gdata.* are outside protos with mising documentation 751 type DownloadParameters struct { 752 // AllowGzipCompression: # gdata.* are outside protos with mising documentation 753 AllowGzipCompression bool `json:"allowGzipCompression,omitempty"` 754 // IgnoreRange: # gdata.* are outside protos with mising documentation 755 IgnoreRange bool `json:"ignoreRange,omitempty"` 756 // ForceSendFields is a list of field names (e.g. "AllowGzipCompression") to 757 // unconditionally include in API requests. By default, fields with empty or 758 // default values are omitted from API requests. See 759 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 760 // details. 761 ForceSendFields []string `json:"-"` 762 // NullFields is a list of field names (e.g. "AllowGzipCompression") to include 763 // in API requests with the JSON null value. By default, fields with empty 764 // values are omitted from API requests. See 765 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 766 NullFields []string `json:"-"` 767 } 768 769 func (s *DownloadParameters) MarshalJSON() ([]byte, error) { 770 type NoMethod DownloadParameters 771 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 772 } 773 774 // EmailMessage: An email associated with a support case. 775 type EmailMessage struct { 776 // Actor: Output only. The user or Google Support agent that created this email 777 // message. This is inferred from the headers on the email message. 778 Actor *Actor `json:"actor,omitempty"` 779 // BodyContent: Output only. The full email message body. A best-effort attempt 780 // is made to remove extraneous reply threads. 781 BodyContent *TextContent `json:"bodyContent,omitempty"` 782 // CcEmailAddresses: Output only. Email addresses CCed on the email. 783 CcEmailAddresses []string `json:"ccEmailAddresses,omitempty"` 784 // CreateTime: Output only. Time when this email message object was created. 785 CreateTime string `json:"createTime,omitempty"` 786 // Name: Identifier. Resource name for the email message. 787 Name string `json:"name,omitempty"` 788 // RecipientEmailAddresses: Output only. Email addresses the email was sent to. 789 RecipientEmailAddresses []string `json:"recipientEmailAddresses,omitempty"` 790 // Subject: Output only. Subject of the email. 791 Subject string `json:"subject,omitempty"` 792 // ForceSendFields is a list of field names (e.g. "Actor") to unconditionally 793 // include in API requests. By default, fields with empty or default values are 794 // omitted from API requests. See 795 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 796 // details. 797 ForceSendFields []string `json:"-"` 798 // NullFields is a list of field names (e.g. "Actor") to include in API 799 // requests with the JSON null value. By default, fields with empty values are 800 // omitted from API requests. See 801 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 802 NullFields []string `json:"-"` 803 } 804 805 func (s *EmailMessage) MarshalJSON() ([]byte, error) { 806 type NoMethod EmailMessage 807 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 808 } 809 810 // EscalateCaseRequest: The request message for the EscalateCase endpoint. 811 type EscalateCaseRequest struct { 812 // Escalation: The escalation information to be sent with the escalation 813 // request. 814 Escalation *Escalation `json:"escalation,omitempty"` 815 // ForceSendFields is a list of field names (e.g. "Escalation") to 816 // unconditionally include in API requests. By default, fields with empty or 817 // default values are omitted from API requests. See 818 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 819 // details. 820 ForceSendFields []string `json:"-"` 821 // NullFields is a list of field names (e.g. "Escalation") to include in API 822 // requests with the JSON null value. By default, fields with empty values are 823 // omitted from API requests. See 824 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 825 NullFields []string `json:"-"` 826 } 827 828 func (s *EscalateCaseRequest) MarshalJSON() ([]byte, error) { 829 type NoMethod EscalateCaseRequest 830 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 831 } 832 833 // Escalation: An escalation of a support case. 834 type Escalation struct { 835 // Justification: Required. A free text description to accompany the `reason` 836 // field above. Provides additional context on why the case is being escalated. 837 Justification string `json:"justification,omitempty"` 838 // Reason: Required. The reason why the Case is being escalated. 839 // 840 // Possible values: 841 // "REASON_UNSPECIFIED" - The escalation reason is in an unknown state or has 842 // not been specified. 843 // "RESOLUTION_TIME" - The case is taking too long to resolve. 844 // "TECHNICAL_EXPERTISE" - The support agent does not have the expertise 845 // required to successfully resolve the issue. 846 // "BUSINESS_IMPACT" - The issue is having a significant business impact. 847 Reason string `json:"reason,omitempty"` 848 // ForceSendFields is a list of field names (e.g. "Justification") to 849 // unconditionally include in API requests. By default, fields with empty or 850 // default values are omitted from API requests. See 851 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 852 // details. 853 ForceSendFields []string `json:"-"` 854 // NullFields is a list of field names (e.g. "Justification") to include in API 855 // requests with the JSON null value. By default, fields with empty values are 856 // omitted from API requests. See 857 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 858 NullFields []string `json:"-"` 859 } 860 861 func (s *Escalation) MarshalJSON() ([]byte, error) { 862 type NoMethod Escalation 863 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 864 } 865 866 // FeedItem: A feed item associated with a support case. 867 type FeedItem struct { 868 // Attachment: Output only. An attachment attached to the case. 869 Attachment *Attachment `json:"attachment,omitempty"` 870 // Comment: Output only. A comment added to the case. 871 Comment *Comment `json:"comment,omitempty"` 872 // DeletedAttachment: Output only. A deleted attachment that used to be 873 // associated with the support case. 874 DeletedAttachment *Attachment `json:"deletedAttachment,omitempty"` 875 // EmailMessage: Output only. An email message received in reply to the case. 876 EmailMessage *EmailMessage `json:"emailMessage,omitempty"` 877 // EventTime: Output only. Time corresponding to the event of this item. 878 EventTime string `json:"eventTime,omitempty"` 879 // ForceSendFields is a list of field names (e.g. "Attachment") to 880 // unconditionally include in API requests. By default, fields with empty or 881 // default values are omitted from API requests. See 882 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 883 // details. 884 ForceSendFields []string `json:"-"` 885 // NullFields is a list of field names (e.g. "Attachment") to include in API 886 // requests with the JSON null value. By default, fields with empty values are 887 // omitted from API requests. See 888 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 889 NullFields []string `json:"-"` 890 } 891 892 func (s *FeedItem) MarshalJSON() ([]byte, error) { 893 type NoMethod FeedItem 894 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 895 } 896 897 // ListAttachmentsResponse: The response message for the ListAttachments 898 // endpoint. 899 type ListAttachmentsResponse struct { 900 // Attachments: The list of attachments associated with a case. 901 Attachments []*Attachment `json:"attachments,omitempty"` 902 // NextPageToken: A token to retrieve the next page of results. Set this in the 903 // `page_token` field of subsequent `cases.attachments.list` requests. If 904 // unspecified, there are no more results to retrieve. 905 NextPageToken string `json:"nextPageToken,omitempty"` 906 907 // ServerResponse contains the HTTP response code and headers from the server. 908 googleapi.ServerResponse `json:"-"` 909 // ForceSendFields is a list of field names (e.g. "Attachments") to 910 // unconditionally include in API requests. By default, fields with empty or 911 // default values are omitted from API requests. See 912 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 913 // details. 914 ForceSendFields []string `json:"-"` 915 // NullFields is a list of field names (e.g. "Attachments") to include in API 916 // requests with the JSON null value. By default, fields with empty values are 917 // omitted from API requests. See 918 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 919 NullFields []string `json:"-"` 920 } 921 922 func (s *ListAttachmentsResponse) MarshalJSON() ([]byte, error) { 923 type NoMethod ListAttachmentsResponse 924 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 925 } 926 927 // ListCasesResponse: The response message for the ListCases endpoint. 928 type ListCasesResponse struct { 929 // Cases: The list of cases associated with the parent after any filters have 930 // been applied. 931 Cases []*Case `json:"cases,omitempty"` 932 // NextPageToken: A token to retrieve the next page of results. Set this in the 933 // `page_token` field of subsequent `cases.list` requests. If unspecified, 934 // there are no more results to retrieve. 935 NextPageToken string `json:"nextPageToken,omitempty"` 936 937 // ServerResponse contains the HTTP response code and headers from the server. 938 googleapi.ServerResponse `json:"-"` 939 // ForceSendFields is a list of field names (e.g. "Cases") to unconditionally 940 // include in API requests. By default, fields with empty or default values are 941 // omitted from API requests. See 942 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 943 // details. 944 ForceSendFields []string `json:"-"` 945 // NullFields is a list of field names (e.g. "Cases") to include in API 946 // requests with the JSON null value. By default, fields with empty values are 947 // omitted from API requests. See 948 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 949 NullFields []string `json:"-"` 950 } 951 952 func (s *ListCasesResponse) MarshalJSON() ([]byte, error) { 953 type NoMethod ListCasesResponse 954 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 955 } 956 957 // ListCommentsResponse: The response message for the ListComments endpoint. 958 type ListCommentsResponse struct { 959 // Comments: List of the comments associated with the case. 960 Comments []*Comment `json:"comments,omitempty"` 961 // NextPageToken: A token to retrieve the next page of results. Set this in the 962 // `page_token` field of subsequent `cases.comments.list` requests. If 963 // unspecified, there are no more results to retrieve. 964 NextPageToken string `json:"nextPageToken,omitempty"` 965 966 // ServerResponse contains the HTTP response code and headers from the server. 967 googleapi.ServerResponse `json:"-"` 968 // ForceSendFields is a list of field names (e.g. "Comments") to 969 // unconditionally include in API requests. By default, fields with empty or 970 // default values are omitted from API requests. See 971 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 972 // details. 973 ForceSendFields []string `json:"-"` 974 // NullFields is a list of field names (e.g. "Comments") to include in API 975 // requests with the JSON null value. By default, fields with empty values are 976 // omitted from API requests. See 977 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 978 NullFields []string `json:"-"` 979 } 980 981 func (s *ListCommentsResponse) MarshalJSON() ([]byte, error) { 982 type NoMethod ListCommentsResponse 983 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 984 } 985 986 // Media: # gdata.* are outside protos with mising documentation 987 type Media struct { 988 // Algorithm: # gdata.* are outside protos with mising documentation 989 Algorithm string `json:"algorithm,omitempty"` 990 // BigstoreObjectRef: # gdata.* are outside protos with mising documentation 991 BigstoreObjectRef string `json:"bigstoreObjectRef,omitempty"` 992 // BlobRef: # gdata.* are outside protos with mising documentation 993 BlobRef string `json:"blobRef,omitempty"` 994 // Blobstore2Info: # gdata.* are outside protos with mising documentation 995 Blobstore2Info *Blobstore2Info `json:"blobstore2Info,omitempty"` 996 // CompositeMedia: # gdata.* are outside protos with mising documentation 997 CompositeMedia []*CompositeMedia `json:"compositeMedia,omitempty"` 998 // ContentType: # gdata.* are outside protos with mising documentation 999 ContentType string `json:"contentType,omitempty"` 1000 // ContentTypeInfo: # gdata.* are outside protos with mising documentation 1001 ContentTypeInfo *ContentTypeInfo `json:"contentTypeInfo,omitempty"` 1002 // CosmoBinaryReference: # gdata.* are outside protos with mising documentation 1003 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"` 1004 // Crc32cHash: # gdata.* are outside protos with mising documentation 1005 Crc32cHash int64 `json:"crc32cHash,omitempty"` 1006 // DiffChecksumsResponse: # gdata.* are outside protos with mising 1007 // documentation 1008 DiffChecksumsResponse *DiffChecksumsResponse `json:"diffChecksumsResponse,omitempty"` 1009 // DiffDownloadResponse: # gdata.* are outside protos with mising documentation 1010 DiffDownloadResponse *DiffDownloadResponse `json:"diffDownloadResponse,omitempty"` 1011 // DiffUploadRequest: # gdata.* are outside protos with mising documentation 1012 DiffUploadRequest *DiffUploadRequest `json:"diffUploadRequest,omitempty"` 1013 // DiffUploadResponse: # gdata.* are outside protos with mising documentation 1014 DiffUploadResponse *DiffUploadResponse `json:"diffUploadResponse,omitempty"` 1015 // DiffVersionResponse: # gdata.* are outside protos with mising documentation 1016 DiffVersionResponse *DiffVersionResponse `json:"diffVersionResponse,omitempty"` 1017 // DownloadParameters: # gdata.* are outside protos with mising documentation 1018 DownloadParameters *DownloadParameters `json:"downloadParameters,omitempty"` 1019 // Filename: # gdata.* are outside protos with mising documentation 1020 Filename string `json:"filename,omitempty"` 1021 // Hash: # gdata.* are outside protos with mising documentation 1022 Hash string `json:"hash,omitempty"` 1023 // HashVerified: # gdata.* are outside protos with mising documentation 1024 HashVerified bool `json:"hashVerified,omitempty"` 1025 // Inline: # gdata.* are outside protos with mising documentation 1026 Inline string `json:"inline,omitempty"` 1027 // IsPotentialRetry: # gdata.* are outside protos with mising documentation 1028 IsPotentialRetry bool `json:"isPotentialRetry,omitempty"` 1029 // Length: # gdata.* are outside protos with mising documentation 1030 Length int64 `json:"length,omitempty,string"` 1031 // Md5Hash: # gdata.* are outside protos with mising documentation 1032 Md5Hash string `json:"md5Hash,omitempty"` 1033 // MediaId: # gdata.* are outside protos with mising documentation 1034 MediaId string `json:"mediaId,omitempty"` 1035 // ObjectId: # gdata.* are outside protos with mising documentation 1036 ObjectId *ObjectId `json:"objectId,omitempty"` 1037 // Path: # gdata.* are outside protos with mising documentation 1038 Path string `json:"path,omitempty"` 1039 // ReferenceType: # gdata.* are outside protos with mising documentation 1040 // 1041 // Possible values: 1042 // "PATH" - # gdata.* are outside protos with mising documentation 1043 // "BLOB_REF" - # gdata.* are outside protos with mising documentation 1044 // "INLINE" - # gdata.* are outside protos with mising documentation 1045 // "GET_MEDIA" - # gdata.* are outside protos with mising documentation 1046 // "COMPOSITE_MEDIA" - # gdata.* are outside protos with mising documentation 1047 // "BIGSTORE_REF" - # gdata.* are outside protos with mising documentation 1048 // "DIFF_VERSION_RESPONSE" - # gdata.* are outside protos with mising 1049 // documentation 1050 // "DIFF_CHECKSUMS_RESPONSE" - # gdata.* are outside protos with mising 1051 // documentation 1052 // "DIFF_DOWNLOAD_RESPONSE" - # gdata.* are outside protos with mising 1053 // documentation 1054 // "DIFF_UPLOAD_REQUEST" - # gdata.* are outside protos with mising 1055 // documentation 1056 // "DIFF_UPLOAD_RESPONSE" - # gdata.* are outside protos with mising 1057 // documentation 1058 // "COSMO_BINARY_REFERENCE" - # gdata.* are outside protos with mising 1059 // documentation 1060 // "ARBITRARY_BYTES" - # gdata.* are outside protos with mising documentation 1061 ReferenceType string `json:"referenceType,omitempty"` 1062 // Sha1Hash: # gdata.* are outside protos with mising documentation 1063 Sha1Hash string `json:"sha1Hash,omitempty"` 1064 // Sha256Hash: # gdata.* are outside protos with mising documentation 1065 Sha256Hash string `json:"sha256Hash,omitempty"` 1066 // Timestamp: # gdata.* are outside protos with mising documentation 1067 Timestamp uint64 `json:"timestamp,omitempty,string"` 1068 // Token: # gdata.* are outside protos with mising documentation 1069 Token string `json:"token,omitempty"` 1070 1071 // ServerResponse contains the HTTP response code and headers from the server. 1072 googleapi.ServerResponse `json:"-"` 1073 // ForceSendFields is a list of field names (e.g. "Algorithm") to 1074 // unconditionally include in API requests. By default, fields with empty or 1075 // default values are omitted from API requests. See 1076 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1077 // details. 1078 ForceSendFields []string `json:"-"` 1079 // NullFields is a list of field names (e.g. "Algorithm") to include in API 1080 // requests with the JSON null value. By default, fields with empty values are 1081 // omitted from API requests. See 1082 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1083 NullFields []string `json:"-"` 1084 } 1085 1086 func (s *Media) MarshalJSON() ([]byte, error) { 1087 type NoMethod Media 1088 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1089 } 1090 1091 // ObjectId: # gdata.* are outside protos with mising documentation 1092 type ObjectId struct { 1093 // BucketName: # gdata.* are outside protos with mising documentation 1094 BucketName string `json:"bucketName,omitempty"` 1095 // Generation: # gdata.* are outside protos with mising documentation 1096 Generation int64 `json:"generation,omitempty,string"` 1097 // ObjectName: # gdata.* are outside protos with mising documentation 1098 ObjectName string `json:"objectName,omitempty"` 1099 // ForceSendFields is a list of field names (e.g. "BucketName") to 1100 // unconditionally include in API requests. By default, fields with empty or 1101 // default values are omitted from API requests. See 1102 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1103 // details. 1104 ForceSendFields []string `json:"-"` 1105 // NullFields is a list of field names (e.g. "BucketName") to include in API 1106 // requests with the JSON null value. By default, fields with empty values are 1107 // omitted from API requests. See 1108 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1109 NullFields []string `json:"-"` 1110 } 1111 1112 func (s *ObjectId) MarshalJSON() ([]byte, error) { 1113 type NoMethod ObjectId 1114 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1115 } 1116 1117 // Product: The product a case may be associated with. 1118 type Product struct { 1119 // ProductLine: The product line of the Product. 1120 // 1121 // Possible values: 1122 // "PRODUCT_LINE_UNSPECIFIED" - Unknown product type. 1123 // "GOOGLE_CLOUD" - Google Cloud 1124 // "GOOGLE_MAPS" - Google Maps 1125 ProductLine string `json:"productLine,omitempty"` 1126 // ForceSendFields is a list of field names (e.g. "ProductLine") to 1127 // unconditionally include in API requests. By default, fields with empty or 1128 // default values are omitted from API requests. See 1129 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1130 // details. 1131 ForceSendFields []string `json:"-"` 1132 // NullFields is a list of field names (e.g. "ProductLine") to include in API 1133 // requests with the JSON null value. By default, fields with empty values are 1134 // omitted from API requests. See 1135 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1136 NullFields []string `json:"-"` 1137 } 1138 1139 func (s *Product) MarshalJSON() ([]byte, error) { 1140 type NoMethod Product 1141 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1142 } 1143 1144 // SearchCaseClassificationsResponse: The response message for 1145 // SearchCaseClassifications endpoint. 1146 type SearchCaseClassificationsResponse struct { 1147 // CaseClassifications: The classifications retrieved. 1148 CaseClassifications []*CaseClassification `json:"caseClassifications,omitempty"` 1149 // NextPageToken: A token to retrieve the next page of results. Set this in the 1150 // `page_token` field of subsequent `caseClassifications.list` requests. If 1151 // unspecified, there are no more results to retrieve. 1152 NextPageToken string `json:"nextPageToken,omitempty"` 1153 1154 // ServerResponse contains the HTTP response code and headers from the server. 1155 googleapi.ServerResponse `json:"-"` 1156 // ForceSendFields is a list of field names (e.g. "CaseClassifications") to 1157 // unconditionally include in API requests. By default, fields with empty or 1158 // default values are omitted from API requests. See 1159 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1160 // details. 1161 ForceSendFields []string `json:"-"` 1162 // NullFields is a list of field names (e.g. "CaseClassifications") to include 1163 // in API requests with the JSON null value. By default, fields with empty 1164 // values are omitted from API requests. See 1165 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1166 NullFields []string `json:"-"` 1167 } 1168 1169 func (s *SearchCaseClassificationsResponse) MarshalJSON() ([]byte, error) { 1170 type NoMethod SearchCaseClassificationsResponse 1171 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1172 } 1173 1174 // SearchCasesResponse: The response message for the SearchCases endpoint. 1175 type SearchCasesResponse struct { 1176 // Cases: The list of cases associated with the parent after any filters have 1177 // been applied. 1178 Cases []*Case `json:"cases,omitempty"` 1179 // NextPageToken: A token to retrieve the next page of results. Set this in the 1180 // `page_token` field of subsequent `cases.search` requests. If unspecified, 1181 // there are no more results to retrieve. 1182 NextPageToken string `json:"nextPageToken,omitempty"` 1183 1184 // ServerResponse contains the HTTP response code and headers from the server. 1185 googleapi.ServerResponse `json:"-"` 1186 // ForceSendFields is a list of field names (e.g. "Cases") to unconditionally 1187 // include in API requests. By default, fields with empty or default values are 1188 // omitted from API requests. See 1189 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1190 // details. 1191 ForceSendFields []string `json:"-"` 1192 // NullFields is a list of field names (e.g. "Cases") to include in API 1193 // requests with the JSON null value. By default, fields with empty values are 1194 // omitted from API requests. See 1195 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1196 NullFields []string `json:"-"` 1197 } 1198 1199 func (s *SearchCasesResponse) MarshalJSON() ([]byte, error) { 1200 type NoMethod SearchCasesResponse 1201 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1202 } 1203 1204 // ShowFeedResponse: The response message for the ShowFeed endpoint. 1205 type ShowFeedResponse struct { 1206 // FeedItems: The list of feed items associated with the given Case. 1207 FeedItems []*FeedItem `json:"feedItems,omitempty"` 1208 // NextPageToken: A token to retrieve the next page of results. This should be 1209 // set in the `page_token` field of subsequent `ShowFeedRequests`. If 1210 // unspecified, there are no more results to retrieve. 1211 NextPageToken string `json:"nextPageToken,omitempty"` 1212 1213 // ServerResponse contains the HTTP response code and headers from the server. 1214 googleapi.ServerResponse `json:"-"` 1215 // ForceSendFields is a list of field names (e.g. "FeedItems") to 1216 // unconditionally include in API requests. By default, fields with empty or 1217 // default values are omitted from API requests. See 1218 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1219 // details. 1220 ForceSendFields []string `json:"-"` 1221 // NullFields is a list of field names (e.g. "FeedItems") to include in API 1222 // requests with the JSON null value. By default, fields with empty values are 1223 // omitted from API requests. See 1224 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1225 NullFields []string `json:"-"` 1226 } 1227 1228 func (s *ShowFeedResponse) MarshalJSON() ([]byte, error) { 1229 type NoMethod ShowFeedResponse 1230 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1231 } 1232 1233 // TextContent: Stores text attached to a support object. 1234 type TextContent struct { 1235 // PlainText: Content in this field should be rendered and interpreted as-is. 1236 PlainText string `json:"plainText,omitempty"` 1237 // ForceSendFields is a list of field names (e.g. "PlainText") to 1238 // unconditionally include in API requests. By default, fields with empty or 1239 // default values are omitted from API requests. See 1240 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1241 // details. 1242 ForceSendFields []string `json:"-"` 1243 // NullFields is a list of field names (e.g. "PlainText") to include in API 1244 // requests with the JSON null value. By default, fields with empty values are 1245 // omitted from API requests. See 1246 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1247 NullFields []string `json:"-"` 1248 } 1249 1250 func (s *TextContent) MarshalJSON() ([]byte, error) { 1251 type NoMethod TextContent 1252 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1253 } 1254 1255 // WorkflowOperationMetadata: Metadata about the operation. Used to lookup the 1256 // current status. 1257 type WorkflowOperationMetadata struct { 1258 // Namespace: The namespace that the job was scheduled in. Must be included in 1259 // the workflow metadata so the workflow status can be retrieved. 1260 Namespace string `json:"namespace,omitempty"` 1261 // OperationAction: The type of action the operation is classified as. 1262 // 1263 // Possible values: 1264 // "OPERATION_ACTION_UNSPECIFIED" - Operation action is not specified. 1265 // "CREATE_SUPPORT_ACCOUNT" - Operation pertains to the creation of a new 1266 // support account. 1267 // "UPDATE_SUPPORT_ACCOUNT" - Operation pertains to the updating of an 1268 // existing support account. 1269 // "PURCHASE_SUPPORT_ACCOUNT" - Operation pertains to the purchasing of a 1270 // support plan that may either create or update a support account. 1271 OperationAction string `json:"operationAction,omitempty"` 1272 // WorkflowOperationType: Which version of the workflow service this operation 1273 // came from. 1274 // 1275 // Possible values: 1276 // "UNKNOWN_OPERATION_TYPE" - Unknown version. 1277 // "WORKFLOWS_V1" - Version 1. 1278 // "WORKFLOWS_V2" - Version 2. 1279 WorkflowOperationType string `json:"workflowOperationType,omitempty"` 1280 // ForceSendFields is a list of field names (e.g. "Namespace") to 1281 // unconditionally include in API requests. By default, fields with empty or 1282 // default values are omitted from API requests. See 1283 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1284 // details. 1285 ForceSendFields []string `json:"-"` 1286 // NullFields is a list of field names (e.g. "Namespace") to include in API 1287 // requests with the JSON null value. By default, fields with empty values are 1288 // omitted from API requests. See 1289 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1290 NullFields []string `json:"-"` 1291 } 1292 1293 func (s *WorkflowOperationMetadata) MarshalJSON() ([]byte, error) { 1294 type NoMethod WorkflowOperationMetadata 1295 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1296 } 1297 1298 type CaseClassificationsSearchCall struct { 1299 s *Service 1300 urlParams_ gensupport.URLParams 1301 ifNoneMatch_ string 1302 ctx_ context.Context 1303 header_ http.Header 1304 } 1305 1306 // Search: Retrieve valid classifications to use when creating a support case. 1307 // Classifications are hierarchical. Each classification is a string containing 1308 // all levels of the hierarchy separated by " > ". For example, "Technical 1309 // Issue > Compute > Compute Engine". Classification IDs returned by this 1310 // endpoint are valid for at least six months. When a classification is 1311 // deactivated, this endpoint immediately stops returning it. After six months, 1312 // `case.create` requests using the classification will fail. EXAMPLES: cURL: 1313 // ```shell curl \ --header "Authorization: Bearer $(gcloud auth 1314 // print-access-token)" \ 1315 // 'https://cloudsupport.googleapis.com/v2/caseClassifications:search?query=disp 1316 // lay_name:"*Compute%20Engine*"' ``` Python: ```python import 1317 // googleapiclient.discovery supportApiService = 1318 // googleapiclient.discovery.build( serviceName="cloudsupport", version="v2", 1319 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1320 // sion=v2", ) request = supportApiService.caseClassifications().search( 1321 // query='display_name:"*Compute Engine*"' ) print(request.execute()) ``` 1322 func (r *CaseClassificationsService) Search() *CaseClassificationsSearchCall { 1323 c := &CaseClassificationsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1324 return c 1325 } 1326 1327 // PageSize sets the optional parameter "pageSize": The maximum number of 1328 // classifications fetched with each request. 1329 func (c *CaseClassificationsSearchCall) PageSize(pageSize int64) *CaseClassificationsSearchCall { 1330 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1331 return c 1332 } 1333 1334 // PageToken sets the optional parameter "pageToken": A token identifying the 1335 // page of results to return. If unspecified, the first page is retrieved. 1336 func (c *CaseClassificationsSearchCall) PageToken(pageToken string) *CaseClassificationsSearchCall { 1337 c.urlParams_.Set("pageToken", pageToken) 1338 return c 1339 } 1340 1341 // ProductProductLine sets the optional parameter "product.productLine": The 1342 // product line of the Product. 1343 // 1344 // Possible values: 1345 // 1346 // "PRODUCT_LINE_UNSPECIFIED" - Unknown product type. 1347 // "GOOGLE_CLOUD" - Google Cloud 1348 // "GOOGLE_MAPS" - Google Maps 1349 func (c *CaseClassificationsSearchCall) ProductProductLine(productProductLine string) *CaseClassificationsSearchCall { 1350 c.urlParams_.Set("product.productLine", productProductLine) 1351 return c 1352 } 1353 1354 // Query sets the optional parameter "query": An expression used to filter case 1355 // classifications. If it's an empty string, then no filtering happens. 1356 // Otherwise, case classifications will be returned that match the filter. 1357 func (c *CaseClassificationsSearchCall) Query(query string) *CaseClassificationsSearchCall { 1358 c.urlParams_.Set("query", query) 1359 return c 1360 } 1361 1362 // Fields allows partial responses to be retrieved. See 1363 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1364 // details. 1365 func (c *CaseClassificationsSearchCall) Fields(s ...googleapi.Field) *CaseClassificationsSearchCall { 1366 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1367 return c 1368 } 1369 1370 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1371 // object's ETag matches the given value. This is useful for getting updates 1372 // only after the object has changed since the last request. 1373 func (c *CaseClassificationsSearchCall) IfNoneMatch(entityTag string) *CaseClassificationsSearchCall { 1374 c.ifNoneMatch_ = entityTag 1375 return c 1376 } 1377 1378 // Context sets the context to be used in this call's Do method. 1379 func (c *CaseClassificationsSearchCall) Context(ctx context.Context) *CaseClassificationsSearchCall { 1380 c.ctx_ = ctx 1381 return c 1382 } 1383 1384 // Header returns a http.Header that can be modified by the caller to add 1385 // headers to the request. 1386 func (c *CaseClassificationsSearchCall) Header() http.Header { 1387 if c.header_ == nil { 1388 c.header_ = make(http.Header) 1389 } 1390 return c.header_ 1391 } 1392 1393 func (c *CaseClassificationsSearchCall) doRequest(alt string) (*http.Response, error) { 1394 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1395 if c.ifNoneMatch_ != "" { 1396 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1397 } 1398 var body io.Reader = nil 1399 c.urlParams_.Set("alt", alt) 1400 c.urlParams_.Set("prettyPrint", "false") 1401 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/caseClassifications:search") 1402 urls += "?" + c.urlParams_.Encode() 1403 req, err := http.NewRequest("GET", urls, body) 1404 if err != nil { 1405 return nil, err 1406 } 1407 req.Header = reqHeaders 1408 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1409 } 1410 1411 // Do executes the "cloudsupport.caseClassifications.search" call. 1412 // Any non-2xx status code is an error. Response headers are in either 1413 // *SearchCaseClassificationsResponse.ServerResponse.Header or (if a response 1414 // was returned at all) in error.(*googleapi.Error).Header. Use 1415 // googleapi.IsNotModified to check whether the returned error was because 1416 // http.StatusNotModified was returned. 1417 func (c *CaseClassificationsSearchCall) Do(opts ...googleapi.CallOption) (*SearchCaseClassificationsResponse, error) { 1418 gensupport.SetOptions(c.urlParams_, opts...) 1419 res, err := c.doRequest("json") 1420 if res != nil && res.StatusCode == http.StatusNotModified { 1421 if res.Body != nil { 1422 res.Body.Close() 1423 } 1424 return nil, gensupport.WrapError(&googleapi.Error{ 1425 Code: res.StatusCode, 1426 Header: res.Header, 1427 }) 1428 } 1429 if err != nil { 1430 return nil, err 1431 } 1432 defer googleapi.CloseBody(res) 1433 if err := googleapi.CheckResponse(res); err != nil { 1434 return nil, gensupport.WrapError(err) 1435 } 1436 ret := &SearchCaseClassificationsResponse{ 1437 ServerResponse: googleapi.ServerResponse{ 1438 Header: res.Header, 1439 HTTPStatusCode: res.StatusCode, 1440 }, 1441 } 1442 target := &ret 1443 if err := gensupport.DecodeResponse(target, res); err != nil { 1444 return nil, err 1445 } 1446 return ret, nil 1447 } 1448 1449 // Pages invokes f for each page of results. 1450 // A non-nil error returned from f will halt the iteration. 1451 // The provided context supersedes any context provided to the Context method. 1452 func (c *CaseClassificationsSearchCall) Pages(ctx context.Context, f func(*SearchCaseClassificationsResponse) error) error { 1453 c.ctx_ = ctx 1454 defer c.PageToken(c.urlParams_.Get("pageToken")) 1455 for { 1456 x, err := c.Do() 1457 if err != nil { 1458 return err 1459 } 1460 if err := f(x); err != nil { 1461 return err 1462 } 1463 if x.NextPageToken == "" { 1464 return nil 1465 } 1466 c.PageToken(x.NextPageToken) 1467 } 1468 } 1469 1470 type CasesCloseCall struct { 1471 s *Service 1472 name string 1473 closecaserequest *CloseCaseRequest 1474 urlParams_ gensupport.URLParams 1475 ctx_ context.Context 1476 header_ http.Header 1477 } 1478 1479 // Close: Close a case. EXAMPLES: cURL: ```shell 1480 // case="projects/some-project/cases/43595344" curl \ --request POST \ --header 1481 // "Authorization: Bearer $(gcloud auth print-access-token)" \ 1482 // "https://cloudsupport.googleapis.com/v2/$case:close" ``` Python: ```python 1483 // import googleapiclient.discovery api_version = "v2" supportApiService = 1484 // googleapiclient.discovery.build( serviceName="cloudsupport", 1485 // version=api_version, 1486 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1487 // sion={api_version}", ) request = supportApiService.cases().close( 1488 // name="projects/some-project/cases/43595344" ) print(request.execute()) ``` 1489 // 1490 // - name: The name of the case to close. 1491 func (r *CasesService) Close(name string, closecaserequest *CloseCaseRequest) *CasesCloseCall { 1492 c := &CasesCloseCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1493 c.name = name 1494 c.closecaserequest = closecaserequest 1495 return c 1496 } 1497 1498 // Fields allows partial responses to be retrieved. See 1499 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1500 // details. 1501 func (c *CasesCloseCall) Fields(s ...googleapi.Field) *CasesCloseCall { 1502 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1503 return c 1504 } 1505 1506 // Context sets the context to be used in this call's Do method. 1507 func (c *CasesCloseCall) Context(ctx context.Context) *CasesCloseCall { 1508 c.ctx_ = ctx 1509 return c 1510 } 1511 1512 // Header returns a http.Header that can be modified by the caller to add 1513 // headers to the request. 1514 func (c *CasesCloseCall) Header() http.Header { 1515 if c.header_ == nil { 1516 c.header_ = make(http.Header) 1517 } 1518 return c.header_ 1519 } 1520 1521 func (c *CasesCloseCall) doRequest(alt string) (*http.Response, error) { 1522 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1523 var body io.Reader = nil 1524 body, err := googleapi.WithoutDataWrapper.JSONReader(c.closecaserequest) 1525 if err != nil { 1526 return nil, err 1527 } 1528 c.urlParams_.Set("alt", alt) 1529 c.urlParams_.Set("prettyPrint", "false") 1530 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+name}:close") 1531 urls += "?" + c.urlParams_.Encode() 1532 req, err := http.NewRequest("POST", urls, body) 1533 if err != nil { 1534 return nil, err 1535 } 1536 req.Header = reqHeaders 1537 googleapi.Expand(req.URL, map[string]string{ 1538 "name": c.name, 1539 }) 1540 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1541 } 1542 1543 // Do executes the "cloudsupport.cases.close" call. 1544 // Any non-2xx status code is an error. Response headers are in either 1545 // *Case.ServerResponse.Header or (if a response was returned at all) in 1546 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1547 // whether the returned error was because http.StatusNotModified was returned. 1548 func (c *CasesCloseCall) Do(opts ...googleapi.CallOption) (*Case, error) { 1549 gensupport.SetOptions(c.urlParams_, opts...) 1550 res, err := c.doRequest("json") 1551 if res != nil && res.StatusCode == http.StatusNotModified { 1552 if res.Body != nil { 1553 res.Body.Close() 1554 } 1555 return nil, gensupport.WrapError(&googleapi.Error{ 1556 Code: res.StatusCode, 1557 Header: res.Header, 1558 }) 1559 } 1560 if err != nil { 1561 return nil, err 1562 } 1563 defer googleapi.CloseBody(res) 1564 if err := googleapi.CheckResponse(res); err != nil { 1565 return nil, gensupport.WrapError(err) 1566 } 1567 ret := &Case{ 1568 ServerResponse: googleapi.ServerResponse{ 1569 Header: res.Header, 1570 HTTPStatusCode: res.StatusCode, 1571 }, 1572 } 1573 target := &ret 1574 if err := gensupport.DecodeResponse(target, res); err != nil { 1575 return nil, err 1576 } 1577 return ret, nil 1578 } 1579 1580 type CasesCreateCall struct { 1581 s *Service 1582 parent string 1583 case_ *Case 1584 urlParams_ gensupport.URLParams 1585 ctx_ context.Context 1586 header_ http.Header 1587 } 1588 1589 // Create: Create a new case and associate it with a parent. It must have the 1590 // following fields set: `display_name`, `description`, `classification`, and 1591 // `priority`. If you're just testing the API and don't want to route your case 1592 // to an agent, set `testCase=true`. EXAMPLES: cURL: ```shell 1593 // parent="projects/some-project" curl \ --request POST \ --header 1594 // "Authorization: Bearer $(gcloud auth print-access-token)" \ --header 1595 // 'Content-Type: application/json' \ --data '{ "display_name": "Test case 1596 // created by me.", "description": "a random test case, feel free to close", 1597 // "classification": { "id": 1598 // "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN 1599 // 6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8" }, "time_zone": "-07:00", 1600 // "subscriber_email_addresses": [ "foo@domain.com", "bar@domain.com" ], 1601 // "testCase": true, "priority": "P3" }' \ 1602 // "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python: ```python 1603 // import googleapiclient.discovery api_version = "v2" supportApiService = 1604 // googleapiclient.discovery.build( serviceName="cloudsupport", 1605 // version=api_version, 1606 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1607 // sion={api_version}", ) request = supportApiService.cases().create( 1608 // parent="projects/some-project", body={ "displayName": "A Test Case", 1609 // "description": "This is a test case.", "testCase": True, "priority": "P2", 1610 // "classification": { "id": 1611 // "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN 1612 // 6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8" }, }, ) print(request.execute()) 1613 // ``` 1614 // 1615 // - parent: The name of the parent under which the case should be created. 1616 func (r *CasesService) Create(parent string, case_ *Case) *CasesCreateCall { 1617 c := &CasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1618 c.parent = parent 1619 c.case_ = case_ 1620 return c 1621 } 1622 1623 // Fields allows partial responses to be retrieved. See 1624 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1625 // details. 1626 func (c *CasesCreateCall) Fields(s ...googleapi.Field) *CasesCreateCall { 1627 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1628 return c 1629 } 1630 1631 // Context sets the context to be used in this call's Do method. 1632 func (c *CasesCreateCall) Context(ctx context.Context) *CasesCreateCall { 1633 c.ctx_ = ctx 1634 return c 1635 } 1636 1637 // Header returns a http.Header that can be modified by the caller to add 1638 // headers to the request. 1639 func (c *CasesCreateCall) Header() http.Header { 1640 if c.header_ == nil { 1641 c.header_ = make(http.Header) 1642 } 1643 return c.header_ 1644 } 1645 1646 func (c *CasesCreateCall) doRequest(alt string) (*http.Response, error) { 1647 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1648 var body io.Reader = nil 1649 body, err := googleapi.WithoutDataWrapper.JSONReader(c.case_) 1650 if err != nil { 1651 return nil, err 1652 } 1653 c.urlParams_.Set("alt", alt) 1654 c.urlParams_.Set("prettyPrint", "false") 1655 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/cases") 1656 urls += "?" + c.urlParams_.Encode() 1657 req, err := http.NewRequest("POST", urls, body) 1658 if err != nil { 1659 return nil, err 1660 } 1661 req.Header = reqHeaders 1662 googleapi.Expand(req.URL, map[string]string{ 1663 "parent": c.parent, 1664 }) 1665 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1666 } 1667 1668 // Do executes the "cloudsupport.cases.create" call. 1669 // Any non-2xx status code is an error. Response headers are in either 1670 // *Case.ServerResponse.Header or (if a response was returned at all) in 1671 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1672 // whether the returned error was because http.StatusNotModified was returned. 1673 func (c *CasesCreateCall) Do(opts ...googleapi.CallOption) (*Case, error) { 1674 gensupport.SetOptions(c.urlParams_, opts...) 1675 res, err := c.doRequest("json") 1676 if res != nil && res.StatusCode == http.StatusNotModified { 1677 if res.Body != nil { 1678 res.Body.Close() 1679 } 1680 return nil, gensupport.WrapError(&googleapi.Error{ 1681 Code: res.StatusCode, 1682 Header: res.Header, 1683 }) 1684 } 1685 if err != nil { 1686 return nil, err 1687 } 1688 defer googleapi.CloseBody(res) 1689 if err := googleapi.CheckResponse(res); err != nil { 1690 return nil, gensupport.WrapError(err) 1691 } 1692 ret := &Case{ 1693 ServerResponse: googleapi.ServerResponse{ 1694 Header: res.Header, 1695 HTTPStatusCode: res.StatusCode, 1696 }, 1697 } 1698 target := &ret 1699 if err := gensupport.DecodeResponse(target, res); err != nil { 1700 return nil, err 1701 } 1702 return ret, nil 1703 } 1704 1705 type CasesEscalateCall struct { 1706 s *Service 1707 name string 1708 escalatecaserequest *EscalateCaseRequest 1709 urlParams_ gensupport.URLParams 1710 ctx_ context.Context 1711 header_ http.Header 1712 } 1713 1714 // Escalate: Escalate a case, starting the Google Cloud Support escalation 1715 // management process. This operation is only available for some support 1716 // services. Go to https://cloud.google.com/support and look for 'Technical 1717 // support escalations' in the feature list to find out which ones let you do 1718 // that. EXAMPLES: cURL: ```shell case="projects/some-project/cases/43595344" 1719 // curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth 1720 // print-access-token)" \ --header "Content-Type: application/json" \ --data '{ 1721 // "escalation": { "reason": "BUSINESS_IMPACT", "justification": "This is a 1722 // test escalation." } }' \ 1723 // "https://cloudsupport.googleapis.com/v2/$case:escalate" ``` Python: 1724 // ```python import googleapiclient.discovery api_version = "v2" 1725 // supportApiService = googleapiclient.discovery.build( 1726 // serviceName="cloudsupport", version=api_version, 1727 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1728 // sion={api_version}", ) request = supportApiService.cases().escalate( 1729 // name="projects/some-project/cases/43595344", body={ "escalation": { 1730 // "reason": "BUSINESS_IMPACT", "justification": "This is a test escalation.", 1731 // }, }, ) print(request.execute()) ``` 1732 // 1733 // - name: The name of the case to be escalated. 1734 func (r *CasesService) Escalate(name string, escalatecaserequest *EscalateCaseRequest) *CasesEscalateCall { 1735 c := &CasesEscalateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1736 c.name = name 1737 c.escalatecaserequest = escalatecaserequest 1738 return c 1739 } 1740 1741 // Fields allows partial responses to be retrieved. See 1742 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1743 // details. 1744 func (c *CasesEscalateCall) Fields(s ...googleapi.Field) *CasesEscalateCall { 1745 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1746 return c 1747 } 1748 1749 // Context sets the context to be used in this call's Do method. 1750 func (c *CasesEscalateCall) Context(ctx context.Context) *CasesEscalateCall { 1751 c.ctx_ = ctx 1752 return c 1753 } 1754 1755 // Header returns a http.Header that can be modified by the caller to add 1756 // headers to the request. 1757 func (c *CasesEscalateCall) Header() http.Header { 1758 if c.header_ == nil { 1759 c.header_ = make(http.Header) 1760 } 1761 return c.header_ 1762 } 1763 1764 func (c *CasesEscalateCall) doRequest(alt string) (*http.Response, error) { 1765 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1766 var body io.Reader = nil 1767 body, err := googleapi.WithoutDataWrapper.JSONReader(c.escalatecaserequest) 1768 if err != nil { 1769 return nil, err 1770 } 1771 c.urlParams_.Set("alt", alt) 1772 c.urlParams_.Set("prettyPrint", "false") 1773 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+name}:escalate") 1774 urls += "?" + c.urlParams_.Encode() 1775 req, err := http.NewRequest("POST", urls, body) 1776 if err != nil { 1777 return nil, err 1778 } 1779 req.Header = reqHeaders 1780 googleapi.Expand(req.URL, map[string]string{ 1781 "name": c.name, 1782 }) 1783 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1784 } 1785 1786 // Do executes the "cloudsupport.cases.escalate" call. 1787 // Any non-2xx status code is an error. Response headers are in either 1788 // *Case.ServerResponse.Header or (if a response was returned at all) in 1789 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1790 // whether the returned error was because http.StatusNotModified was returned. 1791 func (c *CasesEscalateCall) Do(opts ...googleapi.CallOption) (*Case, error) { 1792 gensupport.SetOptions(c.urlParams_, opts...) 1793 res, err := c.doRequest("json") 1794 if res != nil && res.StatusCode == http.StatusNotModified { 1795 if res.Body != nil { 1796 res.Body.Close() 1797 } 1798 return nil, gensupport.WrapError(&googleapi.Error{ 1799 Code: res.StatusCode, 1800 Header: res.Header, 1801 }) 1802 } 1803 if err != nil { 1804 return nil, err 1805 } 1806 defer googleapi.CloseBody(res) 1807 if err := googleapi.CheckResponse(res); err != nil { 1808 return nil, gensupport.WrapError(err) 1809 } 1810 ret := &Case{ 1811 ServerResponse: googleapi.ServerResponse{ 1812 Header: res.Header, 1813 HTTPStatusCode: res.StatusCode, 1814 }, 1815 } 1816 target := &ret 1817 if err := gensupport.DecodeResponse(target, res); err != nil { 1818 return nil, err 1819 } 1820 return ret, nil 1821 } 1822 1823 type CasesGetCall struct { 1824 s *Service 1825 name string 1826 urlParams_ gensupport.URLParams 1827 ifNoneMatch_ string 1828 ctx_ context.Context 1829 header_ http.Header 1830 } 1831 1832 // Get: Retrieve a case. EXAMPLES: cURL: ```shell 1833 // case="projects/some-project/cases/16033687" curl \ --header "Authorization: 1834 // Bearer $(gcloud auth print-access-token)" \ 1835 // "https://cloudsupport.googleapis.com/v2/$case" ``` Python: ```python import 1836 // googleapiclient.discovery api_version = "v2" supportApiService = 1837 // googleapiclient.discovery.build( serviceName="cloudsupport", 1838 // version=api_version, 1839 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1840 // sion={api_version}", ) request = supportApiService.cases().get( 1841 // name="projects/some-project/cases/43595344", ) print(request.execute()) ``` 1842 // 1843 // - name: The full name of a case to be retrieved. 1844 func (r *CasesService) Get(name string) *CasesGetCall { 1845 c := &CasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1846 c.name = name 1847 return c 1848 } 1849 1850 // Fields allows partial responses to be retrieved. See 1851 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1852 // details. 1853 func (c *CasesGetCall) Fields(s ...googleapi.Field) *CasesGetCall { 1854 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1855 return c 1856 } 1857 1858 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1859 // object's ETag matches the given value. This is useful for getting updates 1860 // only after the object has changed since the last request. 1861 func (c *CasesGetCall) IfNoneMatch(entityTag string) *CasesGetCall { 1862 c.ifNoneMatch_ = entityTag 1863 return c 1864 } 1865 1866 // Context sets the context to be used in this call's Do method. 1867 func (c *CasesGetCall) Context(ctx context.Context) *CasesGetCall { 1868 c.ctx_ = ctx 1869 return c 1870 } 1871 1872 // Header returns a http.Header that can be modified by the caller to add 1873 // headers to the request. 1874 func (c *CasesGetCall) Header() http.Header { 1875 if c.header_ == nil { 1876 c.header_ = make(http.Header) 1877 } 1878 return c.header_ 1879 } 1880 1881 func (c *CasesGetCall) doRequest(alt string) (*http.Response, error) { 1882 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1883 if c.ifNoneMatch_ != "" { 1884 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1885 } 1886 var body io.Reader = nil 1887 c.urlParams_.Set("alt", alt) 1888 c.urlParams_.Set("prettyPrint", "false") 1889 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+name}") 1890 urls += "?" + c.urlParams_.Encode() 1891 req, err := http.NewRequest("GET", urls, body) 1892 if err != nil { 1893 return nil, err 1894 } 1895 req.Header = reqHeaders 1896 googleapi.Expand(req.URL, map[string]string{ 1897 "name": c.name, 1898 }) 1899 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1900 } 1901 1902 // Do executes the "cloudsupport.cases.get" call. 1903 // Any non-2xx status code is an error. Response headers are in either 1904 // *Case.ServerResponse.Header or (if a response was returned at all) in 1905 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1906 // whether the returned error was because http.StatusNotModified was returned. 1907 func (c *CasesGetCall) Do(opts ...googleapi.CallOption) (*Case, error) { 1908 gensupport.SetOptions(c.urlParams_, opts...) 1909 res, err := c.doRequest("json") 1910 if res != nil && res.StatusCode == http.StatusNotModified { 1911 if res.Body != nil { 1912 res.Body.Close() 1913 } 1914 return nil, gensupport.WrapError(&googleapi.Error{ 1915 Code: res.StatusCode, 1916 Header: res.Header, 1917 }) 1918 } 1919 if err != nil { 1920 return nil, err 1921 } 1922 defer googleapi.CloseBody(res) 1923 if err := googleapi.CheckResponse(res); err != nil { 1924 return nil, gensupport.WrapError(err) 1925 } 1926 ret := &Case{ 1927 ServerResponse: googleapi.ServerResponse{ 1928 Header: res.Header, 1929 HTTPStatusCode: res.StatusCode, 1930 }, 1931 } 1932 target := &ret 1933 if err := gensupport.DecodeResponse(target, res); err != nil { 1934 return nil, err 1935 } 1936 return ret, nil 1937 } 1938 1939 type CasesListCall struct { 1940 s *Service 1941 parent string 1942 urlParams_ gensupport.URLParams 1943 ifNoneMatch_ string 1944 ctx_ context.Context 1945 header_ http.Header 1946 } 1947 1948 // List: Retrieve all cases under a parent, but not its children. For example, 1949 // listing cases under an organization only returns the cases that are directly 1950 // parented by that organization. To retrieve cases under an organization and 1951 // its projects, use `cases.search`. EXAMPLES: cURL: ```shell 1952 // parent="projects/some-project" curl \ --header "Authorization: Bearer 1953 // $(gcloud auth print-access-token)" \ 1954 // "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python: ```python 1955 // import googleapiclient.discovery api_version = "v2" supportApiService = 1956 // googleapiclient.discovery.build( serviceName="cloudsupport", 1957 // version=api_version, 1958 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 1959 // sion={api_version}", ) request = 1960 // supportApiService.cases().list(parent="projects/some-project") 1961 // print(request.execute()) ``` 1962 // 1963 // - parent: The name of a parent to list cases under. 1964 func (r *CasesService) List(parent string) *CasesListCall { 1965 c := &CasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1966 c.parent = parent 1967 return c 1968 } 1969 1970 // Filter sets the optional parameter "filter": An expression used to filter 1971 // cases. If it's an empty string, then no filtering happens. Otherwise, the 1972 // endpoint returns the cases that match the filter. Expressions use the 1973 // following fields separated by `AND` and specified with `=`: - `state`: Can 1974 // be `OPEN` or `CLOSED`. - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. 1975 // You can specify multiple values for priority using the `OR` operator. For 1976 // example, `priority=P1 OR priority=P2`. - `creator.email`: The email address 1977 // of the case creator. EXAMPLES: - `state=CLOSED` - `state=OPEN AND 1978 // creator.email="tester@example.com" - `state=OPEN AND (priority=P0 OR 1979 // priority=P1)` 1980 func (c *CasesListCall) Filter(filter string) *CasesListCall { 1981 c.urlParams_.Set("filter", filter) 1982 return c 1983 } 1984 1985 // PageSize sets the optional parameter "pageSize": The maximum number of cases 1986 // fetched with each request. Defaults to 10. 1987 func (c *CasesListCall) PageSize(pageSize int64) *CasesListCall { 1988 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1989 return c 1990 } 1991 1992 // PageToken sets the optional parameter "pageToken": A token identifying the 1993 // page of results to return. If unspecified, the first page is retrieved. 1994 func (c *CasesListCall) PageToken(pageToken string) *CasesListCall { 1995 c.urlParams_.Set("pageToken", pageToken) 1996 return c 1997 } 1998 1999 // ProductLine sets the optional parameter "productLine": The product line to 2000 // request cases for. If unspecified, only Google Cloud cases will be returned. 2001 // 2002 // Possible values: 2003 // 2004 // "PRODUCT_LINE_UNSPECIFIED" - Unknown product type. 2005 // "GOOGLE_CLOUD" - Google Cloud 2006 // "GOOGLE_MAPS" - Google Maps 2007 func (c *CasesListCall) ProductLine(productLine string) *CasesListCall { 2008 c.urlParams_.Set("productLine", productLine) 2009 return c 2010 } 2011 2012 // Fields allows partial responses to be retrieved. See 2013 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2014 // details. 2015 func (c *CasesListCall) Fields(s ...googleapi.Field) *CasesListCall { 2016 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2017 return c 2018 } 2019 2020 // IfNoneMatch sets an optional parameter which makes the operation fail if the 2021 // object's ETag matches the given value. This is useful for getting updates 2022 // only after the object has changed since the last request. 2023 func (c *CasesListCall) IfNoneMatch(entityTag string) *CasesListCall { 2024 c.ifNoneMatch_ = entityTag 2025 return c 2026 } 2027 2028 // Context sets the context to be used in this call's Do method. 2029 func (c *CasesListCall) Context(ctx context.Context) *CasesListCall { 2030 c.ctx_ = ctx 2031 return c 2032 } 2033 2034 // Header returns a http.Header that can be modified by the caller to add 2035 // headers to the request. 2036 func (c *CasesListCall) Header() http.Header { 2037 if c.header_ == nil { 2038 c.header_ = make(http.Header) 2039 } 2040 return c.header_ 2041 } 2042 2043 func (c *CasesListCall) doRequest(alt string) (*http.Response, error) { 2044 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 2045 if c.ifNoneMatch_ != "" { 2046 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2047 } 2048 var body io.Reader = nil 2049 c.urlParams_.Set("alt", alt) 2050 c.urlParams_.Set("prettyPrint", "false") 2051 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/cases") 2052 urls += "?" + c.urlParams_.Encode() 2053 req, err := http.NewRequest("GET", urls, body) 2054 if err != nil { 2055 return nil, err 2056 } 2057 req.Header = reqHeaders 2058 googleapi.Expand(req.URL, map[string]string{ 2059 "parent": c.parent, 2060 }) 2061 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2062 } 2063 2064 // Do executes the "cloudsupport.cases.list" call. 2065 // Any non-2xx status code is an error. Response headers are in either 2066 // *ListCasesResponse.ServerResponse.Header or (if a response was returned at 2067 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2068 // check whether the returned error was because http.StatusNotModified was 2069 // returned. 2070 func (c *CasesListCall) Do(opts ...googleapi.CallOption) (*ListCasesResponse, error) { 2071 gensupport.SetOptions(c.urlParams_, opts...) 2072 res, err := c.doRequest("json") 2073 if res != nil && res.StatusCode == http.StatusNotModified { 2074 if res.Body != nil { 2075 res.Body.Close() 2076 } 2077 return nil, gensupport.WrapError(&googleapi.Error{ 2078 Code: res.StatusCode, 2079 Header: res.Header, 2080 }) 2081 } 2082 if err != nil { 2083 return nil, err 2084 } 2085 defer googleapi.CloseBody(res) 2086 if err := googleapi.CheckResponse(res); err != nil { 2087 return nil, gensupport.WrapError(err) 2088 } 2089 ret := &ListCasesResponse{ 2090 ServerResponse: googleapi.ServerResponse{ 2091 Header: res.Header, 2092 HTTPStatusCode: res.StatusCode, 2093 }, 2094 } 2095 target := &ret 2096 if err := gensupport.DecodeResponse(target, res); err != nil { 2097 return nil, err 2098 } 2099 return ret, nil 2100 } 2101 2102 // Pages invokes f for each page of results. 2103 // A non-nil error returned from f will halt the iteration. 2104 // The provided context supersedes any context provided to the Context method. 2105 func (c *CasesListCall) Pages(ctx context.Context, f func(*ListCasesResponse) error) error { 2106 c.ctx_ = ctx 2107 defer c.PageToken(c.urlParams_.Get("pageToken")) 2108 for { 2109 x, err := c.Do() 2110 if err != nil { 2111 return err 2112 } 2113 if err := f(x); err != nil { 2114 return err 2115 } 2116 if x.NextPageToken == "" { 2117 return nil 2118 } 2119 c.PageToken(x.NextPageToken) 2120 } 2121 } 2122 2123 type CasesPatchCall struct { 2124 s *Service 2125 name string 2126 case_ *Case 2127 urlParams_ gensupport.URLParams 2128 ctx_ context.Context 2129 header_ http.Header 2130 } 2131 2132 // Patch: Update a case. Only some fields can be updated. EXAMPLES: cURL: 2133 // ```shell case="projects/some-project/cases/43595344" curl \ --request PATCH 2134 // \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ 2135 // --header "Content-Type: application/json" \ --data '{ "priority": "P1" }' \ 2136 // "https://cloudsupport.googleapis.com/v2/$case?updateMask=priority" ``` 2137 // Python: ```python import googleapiclient.discovery api_version = "v2" 2138 // supportApiService = googleapiclient.discovery.build( 2139 // serviceName="cloudsupport", version=api_version, 2140 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 2141 // sion={api_version}", ) request = supportApiService.cases().patch( 2142 // name="projects/some-project/cases/43112854", body={ "displayName": "This is 2143 // Now a New Title", "priority": "P2", }, ) print(request.execute()) ``` 2144 // 2145 // - name: The resource name for the case. 2146 func (r *CasesService) Patch(name string, case_ *Case) *CasesPatchCall { 2147 c := &CasesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2148 c.name = name 2149 c.case_ = case_ 2150 return c 2151 } 2152 2153 // UpdateMask sets the optional parameter "updateMask": A list of attributes of 2154 // the case that should be updated. Supported values are `priority`, 2155 // `display_name`, and `subscriber_email_addresses`. If no fields are 2156 // specified, all supported fields are updated. Be careful - if you do not 2157 // provide a field mask, then you might accidentally clear some fields. For 2158 // example, if you leave the field mask empty and do not provide a value for 2159 // `subscriber_email_addresses`, then `subscriber_email_addresses` is updated 2160 // to empty. 2161 func (c *CasesPatchCall) UpdateMask(updateMask string) *CasesPatchCall { 2162 c.urlParams_.Set("updateMask", updateMask) 2163 return c 2164 } 2165 2166 // Fields allows partial responses to be retrieved. See 2167 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2168 // details. 2169 func (c *CasesPatchCall) Fields(s ...googleapi.Field) *CasesPatchCall { 2170 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2171 return c 2172 } 2173 2174 // Context sets the context to be used in this call's Do method. 2175 func (c *CasesPatchCall) Context(ctx context.Context) *CasesPatchCall { 2176 c.ctx_ = ctx 2177 return c 2178 } 2179 2180 // Header returns a http.Header that can be modified by the caller to add 2181 // headers to the request. 2182 func (c *CasesPatchCall) Header() http.Header { 2183 if c.header_ == nil { 2184 c.header_ = make(http.Header) 2185 } 2186 return c.header_ 2187 } 2188 2189 func (c *CasesPatchCall) doRequest(alt string) (*http.Response, error) { 2190 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 2191 var body io.Reader = nil 2192 body, err := googleapi.WithoutDataWrapper.JSONReader(c.case_) 2193 if err != nil { 2194 return nil, err 2195 } 2196 c.urlParams_.Set("alt", alt) 2197 c.urlParams_.Set("prettyPrint", "false") 2198 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+name}") 2199 urls += "?" + c.urlParams_.Encode() 2200 req, err := http.NewRequest("PATCH", urls, body) 2201 if err != nil { 2202 return nil, err 2203 } 2204 req.Header = reqHeaders 2205 googleapi.Expand(req.URL, map[string]string{ 2206 "name": c.name, 2207 }) 2208 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2209 } 2210 2211 // Do executes the "cloudsupport.cases.patch" call. 2212 // Any non-2xx status code is an error. Response headers are in either 2213 // *Case.ServerResponse.Header or (if a response was returned at all) in 2214 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2215 // whether the returned error was because http.StatusNotModified was returned. 2216 func (c *CasesPatchCall) Do(opts ...googleapi.CallOption) (*Case, error) { 2217 gensupport.SetOptions(c.urlParams_, opts...) 2218 res, err := c.doRequest("json") 2219 if res != nil && res.StatusCode == http.StatusNotModified { 2220 if res.Body != nil { 2221 res.Body.Close() 2222 } 2223 return nil, gensupport.WrapError(&googleapi.Error{ 2224 Code: res.StatusCode, 2225 Header: res.Header, 2226 }) 2227 } 2228 if err != nil { 2229 return nil, err 2230 } 2231 defer googleapi.CloseBody(res) 2232 if err := googleapi.CheckResponse(res); err != nil { 2233 return nil, gensupport.WrapError(err) 2234 } 2235 ret := &Case{ 2236 ServerResponse: googleapi.ServerResponse{ 2237 Header: res.Header, 2238 HTTPStatusCode: res.StatusCode, 2239 }, 2240 } 2241 target := &ret 2242 if err := gensupport.DecodeResponse(target, res); err != nil { 2243 return nil, err 2244 } 2245 return ret, nil 2246 } 2247 2248 type CasesSearchCall struct { 2249 s *Service 2250 urlParams_ gensupport.URLParams 2251 ifNoneMatch_ string 2252 ctx_ context.Context 2253 header_ http.Header 2254 } 2255 2256 // Search: Search for cases using a query. EXAMPLES: cURL: ```shell 2257 // parent="projects/some-project" curl \ --header "Authorization: Bearer 2258 // $(gcloud auth print-access-token)" \ 2259 // "https://cloudsupport.googleapis.com/v2/$parent/cases:search" ``` Python: 2260 // ```python import googleapiclient.discovery api_version = "v2" 2261 // supportApiService = googleapiclient.discovery.build( 2262 // serviceName="cloudsupport", version=api_version, 2263 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 2264 // sion={api_version}", ) request = supportApiService.cases().search( 2265 // parent="projects/some-project", query="state=OPEN" ) 2266 // print(request.execute()) ``` 2267 func (r *CasesService) Search() *CasesSearchCall { 2268 c := &CasesSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2269 return c 2270 } 2271 2272 // PageSize sets the optional parameter "pageSize": The maximum number of cases 2273 // fetched with each request. The default page size is 10. 2274 func (c *CasesSearchCall) PageSize(pageSize int64) *CasesSearchCall { 2275 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2276 return c 2277 } 2278 2279 // PageToken sets the optional parameter "pageToken": A token identifying the 2280 // page of results to return. If unspecified, the first page is retrieved. 2281 func (c *CasesSearchCall) PageToken(pageToken string) *CasesSearchCall { 2282 c.urlParams_.Set("pageToken", pageToken) 2283 return c 2284 } 2285 2286 // Parent sets the optional parameter "parent": The name of the parent resource 2287 // to search for cases under. 2288 func (c *CasesSearchCall) Parent(parent string) *CasesSearchCall { 2289 c.urlParams_.Set("parent", parent) 2290 return c 2291 } 2292 2293 // Query sets the optional parameter "query": An expression used to filter 2294 // cases. Expressions use the following fields separated by `AND` and specified 2295 // with `=`: - `organization`: An organization name in the form 2296 // `organizations/`. - `project`: A project name in the form `projects/`. - 2297 // `state`: Can be `OPEN` or `CLOSED`. - `priority`: Can be `P0`, `P1`, `P2`, 2298 // `P3`, or `P4`. You can specify multiple values for priority using the `OR` 2299 // operator. For example, `priority=P1 OR priority=P2`. - `creator.email`: The 2300 // email address of the case creator. You must specify either `organization` or 2301 // `project`. To search across `displayName`, `description`, and comments, use 2302 // a global restriction with no keyword or operator. For example, "my 2303 // search". To search only cases updated after a certain date, use 2304 // `update_time` restricted with that particular date, time, and timezone in 2305 // ISO datetime format. For example, `update_time>"2020-01-01T00:00:00-05:00". 2306 // `update_time` only supports the greater than operator (`>`). Examples: - 2307 // `organization="organizations/123456789" - 2308 // `project="projects/my-project-id" - `project="projects/123456789" - 2309 // `organization="organizations/123456789" AND state=CLOSED` - 2310 // `project="projects/my-project-id" AND creator.email="tester@example.com" - 2311 // `project="projects/my-project-id" AND (priority=P0 OR priority=P1)` 2312 func (c *CasesSearchCall) Query(query string) *CasesSearchCall { 2313 c.urlParams_.Set("query", query) 2314 return c 2315 } 2316 2317 // Fields allows partial responses to be retrieved. See 2318 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2319 // details. 2320 func (c *CasesSearchCall) Fields(s ...googleapi.Field) *CasesSearchCall { 2321 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2322 return c 2323 } 2324 2325 // IfNoneMatch sets an optional parameter which makes the operation fail if the 2326 // object's ETag matches the given value. This is useful for getting updates 2327 // only after the object has changed since the last request. 2328 func (c *CasesSearchCall) IfNoneMatch(entityTag string) *CasesSearchCall { 2329 c.ifNoneMatch_ = entityTag 2330 return c 2331 } 2332 2333 // Context sets the context to be used in this call's Do method. 2334 func (c *CasesSearchCall) Context(ctx context.Context) *CasesSearchCall { 2335 c.ctx_ = ctx 2336 return c 2337 } 2338 2339 // Header returns a http.Header that can be modified by the caller to add 2340 // headers to the request. 2341 func (c *CasesSearchCall) Header() http.Header { 2342 if c.header_ == nil { 2343 c.header_ = make(http.Header) 2344 } 2345 return c.header_ 2346 } 2347 2348 func (c *CasesSearchCall) doRequest(alt string) (*http.Response, error) { 2349 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 2350 if c.ifNoneMatch_ != "" { 2351 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2352 } 2353 var body io.Reader = nil 2354 c.urlParams_.Set("alt", alt) 2355 c.urlParams_.Set("prettyPrint", "false") 2356 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/cases:search") 2357 urls += "?" + c.urlParams_.Encode() 2358 req, err := http.NewRequest("GET", urls, body) 2359 if err != nil { 2360 return nil, err 2361 } 2362 req.Header = reqHeaders 2363 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2364 } 2365 2366 // Do executes the "cloudsupport.cases.search" call. 2367 // Any non-2xx status code is an error. Response headers are in either 2368 // *SearchCasesResponse.ServerResponse.Header or (if a response was returned at 2369 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2370 // check whether the returned error was because http.StatusNotModified was 2371 // returned. 2372 func (c *CasesSearchCall) Do(opts ...googleapi.CallOption) (*SearchCasesResponse, error) { 2373 gensupport.SetOptions(c.urlParams_, opts...) 2374 res, err := c.doRequest("json") 2375 if res != nil && res.StatusCode == http.StatusNotModified { 2376 if res.Body != nil { 2377 res.Body.Close() 2378 } 2379 return nil, gensupport.WrapError(&googleapi.Error{ 2380 Code: res.StatusCode, 2381 Header: res.Header, 2382 }) 2383 } 2384 if err != nil { 2385 return nil, err 2386 } 2387 defer googleapi.CloseBody(res) 2388 if err := googleapi.CheckResponse(res); err != nil { 2389 return nil, gensupport.WrapError(err) 2390 } 2391 ret := &SearchCasesResponse{ 2392 ServerResponse: googleapi.ServerResponse{ 2393 Header: res.Header, 2394 HTTPStatusCode: res.StatusCode, 2395 }, 2396 } 2397 target := &ret 2398 if err := gensupport.DecodeResponse(target, res); err != nil { 2399 return nil, err 2400 } 2401 return ret, nil 2402 } 2403 2404 // Pages invokes f for each page of results. 2405 // A non-nil error returned from f will halt the iteration. 2406 // The provided context supersedes any context provided to the Context method. 2407 func (c *CasesSearchCall) Pages(ctx context.Context, f func(*SearchCasesResponse) error) error { 2408 c.ctx_ = ctx 2409 defer c.PageToken(c.urlParams_.Get("pageToken")) 2410 for { 2411 x, err := c.Do() 2412 if err != nil { 2413 return err 2414 } 2415 if err := f(x); err != nil { 2416 return err 2417 } 2418 if x.NextPageToken == "" { 2419 return nil 2420 } 2421 c.PageToken(x.NextPageToken) 2422 } 2423 } 2424 2425 type CasesShowFeedCall struct { 2426 s *Service 2427 parent string 2428 urlParams_ gensupport.URLParams 2429 ifNoneMatch_ string 2430 ctx_ context.Context 2431 header_ http.Header 2432 } 2433 2434 // ShowFeed: Show items in the feed of this case, including case emails, 2435 // attachments, and comments. 2436 // 2437 // - parent: The resource name of the case for which feed items should be 2438 // listed. 2439 func (r *CasesService) ShowFeed(parent string) *CasesShowFeedCall { 2440 c := &CasesShowFeedCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2441 c.parent = parent 2442 return c 2443 } 2444 2445 // OrderBy sets the optional parameter "orderBy": Field to order feed items by, 2446 // followed by `asc` or `desc` postfix. The only valid field is 2447 // `creation_time`. This list is case-insensitive, default sorting order is 2448 // ascending, and the redundant space characters are insignificant. Example: 2449 // `creation_time desc` 2450 func (c *CasesShowFeedCall) OrderBy(orderBy string) *CasesShowFeedCall { 2451 c.urlParams_.Set("orderBy", orderBy) 2452 return c 2453 } 2454 2455 // PageSize sets the optional parameter "pageSize": The maximum number of feed 2456 // items fetched with each request. 2457 func (c *CasesShowFeedCall) PageSize(pageSize int64) *CasesShowFeedCall { 2458 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2459 return c 2460 } 2461 2462 // PageToken sets the optional parameter "pageToken": A token identifying the 2463 // page of results to return. If unspecified, it retrieves the first page. 2464 func (c *CasesShowFeedCall) PageToken(pageToken string) *CasesShowFeedCall { 2465 c.urlParams_.Set("pageToken", pageToken) 2466 return c 2467 } 2468 2469 // Fields allows partial responses to be retrieved. See 2470 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2471 // details. 2472 func (c *CasesShowFeedCall) Fields(s ...googleapi.Field) *CasesShowFeedCall { 2473 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2474 return c 2475 } 2476 2477 // IfNoneMatch sets an optional parameter which makes the operation fail if the 2478 // object's ETag matches the given value. This is useful for getting updates 2479 // only after the object has changed since the last request. 2480 func (c *CasesShowFeedCall) IfNoneMatch(entityTag string) *CasesShowFeedCall { 2481 c.ifNoneMatch_ = entityTag 2482 return c 2483 } 2484 2485 // Context sets the context to be used in this call's Do method. 2486 func (c *CasesShowFeedCall) Context(ctx context.Context) *CasesShowFeedCall { 2487 c.ctx_ = ctx 2488 return c 2489 } 2490 2491 // Header returns a http.Header that can be modified by the caller to add 2492 // headers to the request. 2493 func (c *CasesShowFeedCall) Header() http.Header { 2494 if c.header_ == nil { 2495 c.header_ = make(http.Header) 2496 } 2497 return c.header_ 2498 } 2499 2500 func (c *CasesShowFeedCall) doRequest(alt string) (*http.Response, error) { 2501 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 2502 if c.ifNoneMatch_ != "" { 2503 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2504 } 2505 var body io.Reader = nil 2506 c.urlParams_.Set("alt", alt) 2507 c.urlParams_.Set("prettyPrint", "false") 2508 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}:showFeed") 2509 urls += "?" + c.urlParams_.Encode() 2510 req, err := http.NewRequest("GET", urls, body) 2511 if err != nil { 2512 return nil, err 2513 } 2514 req.Header = reqHeaders 2515 googleapi.Expand(req.URL, map[string]string{ 2516 "parent": c.parent, 2517 }) 2518 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2519 } 2520 2521 // Do executes the "cloudsupport.cases.showFeed" call. 2522 // Any non-2xx status code is an error. Response headers are in either 2523 // *ShowFeedResponse.ServerResponse.Header or (if a response was returned at 2524 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2525 // check whether the returned error was because http.StatusNotModified was 2526 // returned. 2527 func (c *CasesShowFeedCall) Do(opts ...googleapi.CallOption) (*ShowFeedResponse, error) { 2528 gensupport.SetOptions(c.urlParams_, opts...) 2529 res, err := c.doRequest("json") 2530 if res != nil && res.StatusCode == http.StatusNotModified { 2531 if res.Body != nil { 2532 res.Body.Close() 2533 } 2534 return nil, gensupport.WrapError(&googleapi.Error{ 2535 Code: res.StatusCode, 2536 Header: res.Header, 2537 }) 2538 } 2539 if err != nil { 2540 return nil, err 2541 } 2542 defer googleapi.CloseBody(res) 2543 if err := googleapi.CheckResponse(res); err != nil { 2544 return nil, gensupport.WrapError(err) 2545 } 2546 ret := &ShowFeedResponse{ 2547 ServerResponse: googleapi.ServerResponse{ 2548 Header: res.Header, 2549 HTTPStatusCode: res.StatusCode, 2550 }, 2551 } 2552 target := &ret 2553 if err := gensupport.DecodeResponse(target, res); err != nil { 2554 return nil, err 2555 } 2556 return ret, nil 2557 } 2558 2559 // Pages invokes f for each page of results. 2560 // A non-nil error returned from f will halt the iteration. 2561 // The provided context supersedes any context provided to the Context method. 2562 func (c *CasesShowFeedCall) Pages(ctx context.Context, f func(*ShowFeedResponse) error) error { 2563 c.ctx_ = ctx 2564 defer c.PageToken(c.urlParams_.Get("pageToken")) 2565 for { 2566 x, err := c.Do() 2567 if err != nil { 2568 return err 2569 } 2570 if err := f(x); err != nil { 2571 return err 2572 } 2573 if x.NextPageToken == "" { 2574 return nil 2575 } 2576 c.PageToken(x.NextPageToken) 2577 } 2578 } 2579 2580 type CasesAttachmentsListCall struct { 2581 s *Service 2582 parent string 2583 urlParams_ gensupport.URLParams 2584 ifNoneMatch_ string 2585 ctx_ context.Context 2586 header_ http.Header 2587 } 2588 2589 // List: List all the attachments associated with a support case. EXAMPLES: 2590 // cURL: ```shell case="projects/some-project/cases/23598314" curl \ --header 2591 // "Authorization: Bearer $(gcloud auth print-access-token)" \ 2592 // "https://cloudsupport.googleapis.com/v2/$case/attachments" ``` Python: 2593 // ```python import googleapiclient.discovery api_version = "v2" 2594 // supportApiService = googleapiclient.discovery.build( 2595 // serviceName="cloudsupport", version=api_version, 2596 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 2597 // sion={api_version}", ) request = ( supportApiService.cases() .attachments() 2598 // .list(parent="projects/some-project/cases/43595344") ) 2599 // print(request.execute()) ``` 2600 // 2601 // - parent: The name of the case for which attachments should be listed. 2602 func (r *CasesAttachmentsService) List(parent string) *CasesAttachmentsListCall { 2603 c := &CasesAttachmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2604 c.parent = parent 2605 return c 2606 } 2607 2608 // PageSize sets the optional parameter "pageSize": The maximum number of 2609 // attachments fetched with each request. If not provided, the default is 10. 2610 // The maximum page size that will be returned is 100. 2611 func (c *CasesAttachmentsListCall) PageSize(pageSize int64) *CasesAttachmentsListCall { 2612 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2613 return c 2614 } 2615 2616 // PageToken sets the optional parameter "pageToken": A token identifying the 2617 // page of results to return. If unspecified, the first page is retrieved. 2618 func (c *CasesAttachmentsListCall) PageToken(pageToken string) *CasesAttachmentsListCall { 2619 c.urlParams_.Set("pageToken", pageToken) 2620 return c 2621 } 2622 2623 // Fields allows partial responses to be retrieved. See 2624 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2625 // details. 2626 func (c *CasesAttachmentsListCall) Fields(s ...googleapi.Field) *CasesAttachmentsListCall { 2627 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2628 return c 2629 } 2630 2631 // IfNoneMatch sets an optional parameter which makes the operation fail if the 2632 // object's ETag matches the given value. This is useful for getting updates 2633 // only after the object has changed since the last request. 2634 func (c *CasesAttachmentsListCall) IfNoneMatch(entityTag string) *CasesAttachmentsListCall { 2635 c.ifNoneMatch_ = entityTag 2636 return c 2637 } 2638 2639 // Context sets the context to be used in this call's Do method. 2640 func (c *CasesAttachmentsListCall) Context(ctx context.Context) *CasesAttachmentsListCall { 2641 c.ctx_ = ctx 2642 return c 2643 } 2644 2645 // Header returns a http.Header that can be modified by the caller to add 2646 // headers to the request. 2647 func (c *CasesAttachmentsListCall) Header() http.Header { 2648 if c.header_ == nil { 2649 c.header_ = make(http.Header) 2650 } 2651 return c.header_ 2652 } 2653 2654 func (c *CasesAttachmentsListCall) doRequest(alt string) (*http.Response, error) { 2655 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 2656 if c.ifNoneMatch_ != "" { 2657 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2658 } 2659 var body io.Reader = nil 2660 c.urlParams_.Set("alt", alt) 2661 c.urlParams_.Set("prettyPrint", "false") 2662 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/attachments") 2663 urls += "?" + c.urlParams_.Encode() 2664 req, err := http.NewRequest("GET", urls, body) 2665 if err != nil { 2666 return nil, err 2667 } 2668 req.Header = reqHeaders 2669 googleapi.Expand(req.URL, map[string]string{ 2670 "parent": c.parent, 2671 }) 2672 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2673 } 2674 2675 // Do executes the "cloudsupport.cases.attachments.list" call. 2676 // Any non-2xx status code is an error. Response headers are in either 2677 // *ListAttachmentsResponse.ServerResponse.Header or (if a response was 2678 // returned at all) in error.(*googleapi.Error).Header. Use 2679 // googleapi.IsNotModified to check whether the returned error was because 2680 // http.StatusNotModified was returned. 2681 func (c *CasesAttachmentsListCall) Do(opts ...googleapi.CallOption) (*ListAttachmentsResponse, error) { 2682 gensupport.SetOptions(c.urlParams_, opts...) 2683 res, err := c.doRequest("json") 2684 if res != nil && res.StatusCode == http.StatusNotModified { 2685 if res.Body != nil { 2686 res.Body.Close() 2687 } 2688 return nil, gensupport.WrapError(&googleapi.Error{ 2689 Code: res.StatusCode, 2690 Header: res.Header, 2691 }) 2692 } 2693 if err != nil { 2694 return nil, err 2695 } 2696 defer googleapi.CloseBody(res) 2697 if err := googleapi.CheckResponse(res); err != nil { 2698 return nil, gensupport.WrapError(err) 2699 } 2700 ret := &ListAttachmentsResponse{ 2701 ServerResponse: googleapi.ServerResponse{ 2702 Header: res.Header, 2703 HTTPStatusCode: res.StatusCode, 2704 }, 2705 } 2706 target := &ret 2707 if err := gensupport.DecodeResponse(target, res); err != nil { 2708 return nil, err 2709 } 2710 return ret, nil 2711 } 2712 2713 // Pages invokes f for each page of results. 2714 // A non-nil error returned from f will halt the iteration. 2715 // The provided context supersedes any context provided to the Context method. 2716 func (c *CasesAttachmentsListCall) Pages(ctx context.Context, f func(*ListAttachmentsResponse) error) error { 2717 c.ctx_ = ctx 2718 defer c.PageToken(c.urlParams_.Get("pageToken")) 2719 for { 2720 x, err := c.Do() 2721 if err != nil { 2722 return err 2723 } 2724 if err := f(x); err != nil { 2725 return err 2726 } 2727 if x.NextPageToken == "" { 2728 return nil 2729 } 2730 c.PageToken(x.NextPageToken) 2731 } 2732 } 2733 2734 type CasesCommentsCreateCall struct { 2735 s *Service 2736 parent string 2737 comment *Comment 2738 urlParams_ gensupport.URLParams 2739 ctx_ context.Context 2740 header_ http.Header 2741 } 2742 2743 // Create: Add a new comment to a case. The comment must have the following 2744 // fields set: `body`. EXAMPLES: cURL: ```shell 2745 // case="projects/some-project/cases/43591344" curl \ --request POST \ --header 2746 // "Authorization: Bearer $(gcloud auth print-access-token)" \ --header 2747 // 'Content-Type: application/json' \ --data '{ "body": "This is a test 2748 // comment." }' \ "https://cloudsupport.googleapis.com/v2/$case/comments" ``` 2749 // Python: ```python import googleapiclient.discovery api_version = "v2" 2750 // supportApiService = googleapiclient.discovery.build( 2751 // serviceName="cloudsupport", version=api_version, 2752 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 2753 // sion={api_version}", ) request = ( supportApiService.cases() .comments() 2754 // .create( parent="projects/some-project/cases/43595344", body={"body": "This 2755 // is a test comment."}, ) ) print(request.execute()) ``` 2756 // 2757 // - parent: The name of the case to which the comment should be added. 2758 func (r *CasesCommentsService) Create(parent string, comment *Comment) *CasesCommentsCreateCall { 2759 c := &CasesCommentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2760 c.parent = parent 2761 c.comment = comment 2762 return c 2763 } 2764 2765 // Fields allows partial responses to be retrieved. See 2766 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2767 // details. 2768 func (c *CasesCommentsCreateCall) Fields(s ...googleapi.Field) *CasesCommentsCreateCall { 2769 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2770 return c 2771 } 2772 2773 // Context sets the context to be used in this call's Do method. 2774 func (c *CasesCommentsCreateCall) Context(ctx context.Context) *CasesCommentsCreateCall { 2775 c.ctx_ = ctx 2776 return c 2777 } 2778 2779 // Header returns a http.Header that can be modified by the caller to add 2780 // headers to the request. 2781 func (c *CasesCommentsCreateCall) Header() http.Header { 2782 if c.header_ == nil { 2783 c.header_ = make(http.Header) 2784 } 2785 return c.header_ 2786 } 2787 2788 func (c *CasesCommentsCreateCall) doRequest(alt string) (*http.Response, error) { 2789 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 2790 var body io.Reader = nil 2791 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 2792 if err != nil { 2793 return nil, err 2794 } 2795 c.urlParams_.Set("alt", alt) 2796 c.urlParams_.Set("prettyPrint", "false") 2797 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/comments") 2798 urls += "?" + c.urlParams_.Encode() 2799 req, err := http.NewRequest("POST", urls, body) 2800 if err != nil { 2801 return nil, err 2802 } 2803 req.Header = reqHeaders 2804 googleapi.Expand(req.URL, map[string]string{ 2805 "parent": c.parent, 2806 }) 2807 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2808 } 2809 2810 // Do executes the "cloudsupport.cases.comments.create" call. 2811 // Any non-2xx status code is an error. Response headers are in either 2812 // *Comment.ServerResponse.Header or (if a response was returned at all) in 2813 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2814 // whether the returned error was because http.StatusNotModified was returned. 2815 func (c *CasesCommentsCreateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 2816 gensupport.SetOptions(c.urlParams_, opts...) 2817 res, err := c.doRequest("json") 2818 if res != nil && res.StatusCode == http.StatusNotModified { 2819 if res.Body != nil { 2820 res.Body.Close() 2821 } 2822 return nil, gensupport.WrapError(&googleapi.Error{ 2823 Code: res.StatusCode, 2824 Header: res.Header, 2825 }) 2826 } 2827 if err != nil { 2828 return nil, err 2829 } 2830 defer googleapi.CloseBody(res) 2831 if err := googleapi.CheckResponse(res); err != nil { 2832 return nil, gensupport.WrapError(err) 2833 } 2834 ret := &Comment{ 2835 ServerResponse: googleapi.ServerResponse{ 2836 Header: res.Header, 2837 HTTPStatusCode: res.StatusCode, 2838 }, 2839 } 2840 target := &ret 2841 if err := gensupport.DecodeResponse(target, res); err != nil { 2842 return nil, err 2843 } 2844 return ret, nil 2845 } 2846 2847 type CasesCommentsListCall struct { 2848 s *Service 2849 parent string 2850 urlParams_ gensupport.URLParams 2851 ifNoneMatch_ string 2852 ctx_ context.Context 2853 header_ http.Header 2854 } 2855 2856 // List: List all the comments associated with a case. EXAMPLES: cURL: ```shell 2857 // case="projects/some-project/cases/43595344" curl \ --header "Authorization: 2858 // Bearer $(gcloud auth print-access-token)" \ 2859 // "https://cloudsupport.googleapis.com/v2/$case/comments" ``` Python: 2860 // ```python import googleapiclient.discovery api_version = "v2" 2861 // supportApiService = googleapiclient.discovery.build( 2862 // serviceName="cloudsupport", version=api_version, 2863 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 2864 // sion={api_version}", ) request = ( supportApiService.cases() .comments() 2865 // .list(parent="projects/some-project/cases/43595344") ) 2866 // print(request.execute()) ``` 2867 // 2868 // - parent: The name of the case for which to list comments. 2869 func (r *CasesCommentsService) List(parent string) *CasesCommentsListCall { 2870 c := &CasesCommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2871 c.parent = parent 2872 return c 2873 } 2874 2875 // PageSize sets the optional parameter "pageSize": The maximum number of 2876 // comments to fetch. Defaults to 10. 2877 func (c *CasesCommentsListCall) PageSize(pageSize int64) *CasesCommentsListCall { 2878 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2879 return c 2880 } 2881 2882 // PageToken sets the optional parameter "pageToken": A token identifying the 2883 // page of results to return. If unspecified, the first page is returned. 2884 func (c *CasesCommentsListCall) PageToken(pageToken string) *CasesCommentsListCall { 2885 c.urlParams_.Set("pageToken", pageToken) 2886 return c 2887 } 2888 2889 // Fields allows partial responses to be retrieved. See 2890 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2891 // details. 2892 func (c *CasesCommentsListCall) Fields(s ...googleapi.Field) *CasesCommentsListCall { 2893 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2894 return c 2895 } 2896 2897 // IfNoneMatch sets an optional parameter which makes the operation fail if the 2898 // object's ETag matches the given value. This is useful for getting updates 2899 // only after the object has changed since the last request. 2900 func (c *CasesCommentsListCall) IfNoneMatch(entityTag string) *CasesCommentsListCall { 2901 c.ifNoneMatch_ = entityTag 2902 return c 2903 } 2904 2905 // Context sets the context to be used in this call's Do method. 2906 func (c *CasesCommentsListCall) Context(ctx context.Context) *CasesCommentsListCall { 2907 c.ctx_ = ctx 2908 return c 2909 } 2910 2911 // Header returns a http.Header that can be modified by the caller to add 2912 // headers to the request. 2913 func (c *CasesCommentsListCall) Header() http.Header { 2914 if c.header_ == nil { 2915 c.header_ = make(http.Header) 2916 } 2917 return c.header_ 2918 } 2919 2920 func (c *CasesCommentsListCall) doRequest(alt string) (*http.Response, error) { 2921 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 2922 if c.ifNoneMatch_ != "" { 2923 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2924 } 2925 var body io.Reader = nil 2926 c.urlParams_.Set("alt", alt) 2927 c.urlParams_.Set("prettyPrint", "false") 2928 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/comments") 2929 urls += "?" + c.urlParams_.Encode() 2930 req, err := http.NewRequest("GET", urls, body) 2931 if err != nil { 2932 return nil, err 2933 } 2934 req.Header = reqHeaders 2935 googleapi.Expand(req.URL, map[string]string{ 2936 "parent": c.parent, 2937 }) 2938 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2939 } 2940 2941 // Do executes the "cloudsupport.cases.comments.list" call. 2942 // Any non-2xx status code is an error. Response headers are in either 2943 // *ListCommentsResponse.ServerResponse.Header or (if a response was returned 2944 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2945 // check whether the returned error was because http.StatusNotModified was 2946 // returned. 2947 func (c *CasesCommentsListCall) Do(opts ...googleapi.CallOption) (*ListCommentsResponse, error) { 2948 gensupport.SetOptions(c.urlParams_, opts...) 2949 res, err := c.doRequest("json") 2950 if res != nil && res.StatusCode == http.StatusNotModified { 2951 if res.Body != nil { 2952 res.Body.Close() 2953 } 2954 return nil, gensupport.WrapError(&googleapi.Error{ 2955 Code: res.StatusCode, 2956 Header: res.Header, 2957 }) 2958 } 2959 if err != nil { 2960 return nil, err 2961 } 2962 defer googleapi.CloseBody(res) 2963 if err := googleapi.CheckResponse(res); err != nil { 2964 return nil, gensupport.WrapError(err) 2965 } 2966 ret := &ListCommentsResponse{ 2967 ServerResponse: googleapi.ServerResponse{ 2968 Header: res.Header, 2969 HTTPStatusCode: res.StatusCode, 2970 }, 2971 } 2972 target := &ret 2973 if err := gensupport.DecodeResponse(target, res); err != nil { 2974 return nil, err 2975 } 2976 return ret, nil 2977 } 2978 2979 // Pages invokes f for each page of results. 2980 // A non-nil error returned from f will halt the iteration. 2981 // The provided context supersedes any context provided to the Context method. 2982 func (c *CasesCommentsListCall) Pages(ctx context.Context, f func(*ListCommentsResponse) error) error { 2983 c.ctx_ = ctx 2984 defer c.PageToken(c.urlParams_.Get("pageToken")) 2985 for { 2986 x, err := c.Do() 2987 if err != nil { 2988 return err 2989 } 2990 if err := f(x); err != nil { 2991 return err 2992 } 2993 if x.NextPageToken == "" { 2994 return nil 2995 } 2996 c.PageToken(x.NextPageToken) 2997 } 2998 } 2999 3000 type MediaDownloadCall struct { 3001 s *Service 3002 name string 3003 urlParams_ gensupport.URLParams 3004 ifNoneMatch_ string 3005 ctx_ context.Context 3006 header_ http.Header 3007 } 3008 3009 // Download: Download a file attached to a case. Note: HTTP requests must 3010 // append "?alt=media" to the URL. EXAMPLES: cURL: ```shell 3011 // name="projects/some-project/cases/43594844/attachments/0674M00000WijAnZAJ" 3012 // curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ 3013 // "https://cloudsupport.googleapis.com/v2/$name:download?alt=media" ``` 3014 // Python: ```python import googleapiclient.discovery api_version = "v2" 3015 // supportApiService = googleapiclient.discovery.build( 3016 // serviceName="cloudsupport", version=api_version, 3017 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 3018 // sion={api_version}", ) request = supportApiService.media().download( 3019 // name="projects/some-project/cases/43595344/attachments/0684M00000Pw6pHQAR" ) 3020 // request.uri = request.uri.split("?")[0] + "?alt=media" 3021 // print(request.execute()) ``` 3022 // 3023 // - name: The name of the file attachment to download. 3024 func (r *MediaService) Download(name string) *MediaDownloadCall { 3025 c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3026 c.name = name 3027 return c 3028 } 3029 3030 // Fields allows partial responses to be retrieved. See 3031 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 3032 // details. 3033 func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall { 3034 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3035 return c 3036 } 3037 3038 // IfNoneMatch sets an optional parameter which makes the operation fail if the 3039 // object's ETag matches the given value. This is useful for getting updates 3040 // only after the object has changed since the last request. 3041 func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall { 3042 c.ifNoneMatch_ = entityTag 3043 return c 3044 } 3045 3046 // Context sets the context to be used in this call's Do and Download methods. 3047 func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall { 3048 c.ctx_ = ctx 3049 return c 3050 } 3051 3052 // Header returns a http.Header that can be modified by the caller to add 3053 // headers to the request. 3054 func (c *MediaDownloadCall) Header() http.Header { 3055 if c.header_ == nil { 3056 c.header_ = make(http.Header) 3057 } 3058 return c.header_ 3059 } 3060 3061 func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) { 3062 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 3063 if c.ifNoneMatch_ != "" { 3064 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3065 } 3066 var body io.Reader = nil 3067 c.urlParams_.Set("alt", alt) 3068 c.urlParams_.Set("prettyPrint", "false") 3069 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+name}:download") 3070 urls += "?" + c.urlParams_.Encode() 3071 req, err := http.NewRequest("GET", urls, body) 3072 if err != nil { 3073 return nil, err 3074 } 3075 req.Header = reqHeaders 3076 googleapi.Expand(req.URL, map[string]string{ 3077 "name": c.name, 3078 }) 3079 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3080 } 3081 3082 // Download fetches the API endpoint's "media" value, instead of the normal 3083 // API response value. If the returned error is nil, the Response is guaranteed to 3084 // have a 2xx status code. Callers must close the Response.Body as usual. 3085 func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 3086 gensupport.SetOptions(c.urlParams_, opts...) 3087 res, err := c.doRequest("media") 3088 if err != nil { 3089 return nil, err 3090 } 3091 if err := googleapi.CheckResponse(res); err != nil { 3092 res.Body.Close() 3093 return nil, gensupport.WrapError(err) 3094 } 3095 return res, nil 3096 } 3097 3098 // Do executes the "cloudsupport.media.download" call. 3099 // Any non-2xx status code is an error. Response headers are in either 3100 // *Media.ServerResponse.Header or (if a response was returned at all) in 3101 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 3102 // whether the returned error was because http.StatusNotModified was returned. 3103 func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*Media, error) { 3104 gensupport.SetOptions(c.urlParams_, opts...) 3105 res, err := c.doRequest("json") 3106 if res != nil && res.StatusCode == http.StatusNotModified { 3107 if res.Body != nil { 3108 res.Body.Close() 3109 } 3110 return nil, gensupport.WrapError(&googleapi.Error{ 3111 Code: res.StatusCode, 3112 Header: res.Header, 3113 }) 3114 } 3115 if err != nil { 3116 return nil, err 3117 } 3118 defer googleapi.CloseBody(res) 3119 if err := googleapi.CheckResponse(res); err != nil { 3120 return nil, gensupport.WrapError(err) 3121 } 3122 ret := &Media{ 3123 ServerResponse: googleapi.ServerResponse{ 3124 Header: res.Header, 3125 HTTPStatusCode: res.StatusCode, 3126 }, 3127 } 3128 target := &ret 3129 if err := gensupport.DecodeResponse(target, res); err != nil { 3130 return nil, err 3131 } 3132 return ret, nil 3133 } 3134 3135 type MediaUploadCall struct { 3136 s *Service 3137 parent string 3138 createattachmentrequest *CreateAttachmentRequest 3139 urlParams_ gensupport.URLParams 3140 mediaInfo_ *gensupport.MediaInfo 3141 ctx_ context.Context 3142 header_ http.Header 3143 } 3144 3145 // Upload: Create a file attachment on a case or Cloud resource. The attachment 3146 // must have the following fields set: `filename`. EXAMPLES: cURL: ```shell 3147 // echo "This text is in a file I'm uploading using CSAPI." \ > 3148 // "./example_file.txt" case="projects/some-project/cases/43594844" curl \ 3149 // --header "Authorization: Bearer $(gcloud auth print-access-token)" \ 3150 // --data-binary @"./example_file.txt" \ 3151 // "https://cloudsupport.googleapis.com/upload/v2beta/$case/attachments?attachme 3152 // nt.filename=uploaded_via_curl.txt" ``` Python: ```python import 3153 // googleapiclient.discovery api_version = "v2" supportApiService = 3154 // googleapiclient.discovery.build( serviceName="cloudsupport", 3155 // version=api_version, 3156 // discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?ver 3157 // sion={api_version}", ) file_path = "./example_file.txt" with open(file_path, 3158 // "w") as file: file.write( "This text is inside a file I'm going to upload 3159 // using the Cloud Support API.", ) request = supportApiService.media().upload( 3160 // parent="projects/some-project/cases/43595344", media_body=file_path ) 3161 // request.uri = request.uri.split("?")[0] + 3162 // "?attachment.filename=uploaded_via_python.txt" print(request.execute()) ``` 3163 // 3164 // - parent: The name of the case or Cloud resource to which the attachment 3165 // should be attached. 3166 func (r *MediaService) Upload(parent string, createattachmentrequest *CreateAttachmentRequest) *MediaUploadCall { 3167 c := &MediaUploadCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3168 c.parent = parent 3169 c.createattachmentrequest = createattachmentrequest 3170 return c 3171 } 3172 3173 // Media specifies the media to upload in one or more chunks. The chunk size 3174 // may be controlled by supplying a MediaOption generated by 3175 // googleapi.ChunkSize. The chunk size defaults to 3176 // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload 3177 // request will be determined by sniffing the contents of r, unless a 3178 // MediaOption generated by googleapi.ContentType is supplied. 3179 // At most one of Media and ResumableMedia may be set. 3180 func (c *MediaUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *MediaUploadCall { 3181 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 3182 return c 3183 } 3184 3185 // ResumableMedia specifies the media to upload in chunks and can be canceled 3186 // with ctx. 3187 // 3188 // Deprecated: use Media instead. 3189 // 3190 // At most one of Media and ResumableMedia may be set. mediaType identifies the 3191 // MIME media type of the upload, such as "image/png". If mediaType is "", it 3192 // will be auto-detected. The provided ctx will supersede any context 3193 // previously provided to the Context method. 3194 func (c *MediaUploadCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *MediaUploadCall { 3195 c.ctx_ = ctx 3196 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 3197 return c 3198 } 3199 3200 // ProgressUpdater provides a callback function that will be called after every 3201 // chunk. It should be a low-latency function in order to not slow down the 3202 // upload operation. This should only be called when using ResumableMedia (as 3203 // opposed to Media). 3204 func (c *MediaUploadCall) ProgressUpdater(pu googleapi.ProgressUpdater) *MediaUploadCall { 3205 c.mediaInfo_.SetProgressUpdater(pu) 3206 return c 3207 } 3208 3209 // Fields allows partial responses to be retrieved. See 3210 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 3211 // details. 3212 func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall { 3213 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3214 return c 3215 } 3216 3217 // Context sets the context to be used in this call's Do method. 3218 // This context will supersede any context previously provided to the 3219 // ResumableMedia method. 3220 func (c *MediaUploadCall) Context(ctx context.Context) *MediaUploadCall { 3221 c.ctx_ = ctx 3222 return c 3223 } 3224 3225 // Header returns a http.Header that can be modified by the caller to add 3226 // headers to the request. 3227 func (c *MediaUploadCall) Header() http.Header { 3228 if c.header_ == nil { 3229 c.header_ = make(http.Header) 3230 } 3231 return c.header_ 3232 } 3233 3234 func (c *MediaUploadCall) doRequest(alt string) (*http.Response, error) { 3235 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 3236 var body io.Reader = nil 3237 body, err := googleapi.WithoutDataWrapper.JSONReader(c.createattachmentrequest) 3238 if err != nil { 3239 return nil, err 3240 } 3241 c.urlParams_.Set("alt", alt) 3242 c.urlParams_.Set("prettyPrint", "false") 3243 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta/{+parent}/attachments") 3244 if c.mediaInfo_ != nil { 3245 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/v2beta/{+parent}/attachments") 3246 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 3247 } 3248 if body == nil { 3249 body = new(bytes.Buffer) 3250 reqHeaders.Set("Content-Type", "application/json") 3251 } 3252 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 3253 defer cleanup() 3254 urls += "?" + c.urlParams_.Encode() 3255 req, err := http.NewRequest("POST", urls, body) 3256 if err != nil { 3257 return nil, err 3258 } 3259 req.Header = reqHeaders 3260 req.GetBody = getBody 3261 googleapi.Expand(req.URL, map[string]string{ 3262 "parent": c.parent, 3263 }) 3264 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3265 } 3266 3267 // Do executes the "cloudsupport.media.upload" call. 3268 // Any non-2xx status code is an error. Response headers are in either 3269 // *Attachment.ServerResponse.Header or (if a response was returned at all) in 3270 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 3271 // whether the returned error was because http.StatusNotModified was returned. 3272 func (c *MediaUploadCall) Do(opts ...googleapi.CallOption) (*Attachment, error) { 3273 gensupport.SetOptions(c.urlParams_, opts...) 3274 res, err := c.doRequest("json") 3275 if res != nil && res.StatusCode == http.StatusNotModified { 3276 if res.Body != nil { 3277 res.Body.Close() 3278 } 3279 return nil, gensupport.WrapError(&googleapi.Error{ 3280 Code: res.StatusCode, 3281 Header: res.Header, 3282 }) 3283 } 3284 if err != nil { 3285 return nil, err 3286 } 3287 defer googleapi.CloseBody(res) 3288 if err := googleapi.CheckResponse(res); err != nil { 3289 return nil, gensupport.WrapError(err) 3290 } 3291 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 3292 if rx != nil { 3293 rx.Client = c.s.client 3294 rx.UserAgent = c.s.userAgent() 3295 ctx := c.ctx_ 3296 if ctx == nil { 3297 ctx = context.TODO() 3298 } 3299 res, err = rx.Upload(ctx) 3300 if err != nil { 3301 return nil, err 3302 } 3303 defer res.Body.Close() 3304 if err := googleapi.CheckResponse(res); err != nil { 3305 return nil, gensupport.WrapError(err) 3306 } 3307 } 3308 ret := &Attachment{ 3309 ServerResponse: googleapi.ServerResponse{ 3310 Header: res.Header, 3311 HTTPStatusCode: res.StatusCode, 3312 }, 3313 } 3314 target := &ret 3315 if err := gensupport.DecodeResponse(target, res); err != nil { 3316 return nil, err 3317 } 3318 return ret, nil 3319 } 3320