| // Copyright 2024 Google LLC. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Code generated file. DO NOT EDIT. |
| |
| // Package essentialcontacts provides access to the Essential Contacts API. |
| // |
| // For product documentation, see: https://cloud.google.com/essentialcontacts/docs/ |
| // |
| // # Library status |
| // |
| // These client libraries are officially supported by Google. However, this |
| // library is considered complete and is in maintenance mode. This means |
| // that we will address critical bugs and security issues but will not add |
| // any new features. |
| // |
| // When possible, we recommend using our newer |
| // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) |
| // that are still actively being worked and iterated on. |
| // |
| // # Creating a client |
| // |
| // Usage example: |
| // |
| // import "google.golang.org/api/essentialcontacts/v1" |
| // ... |
| // ctx := context.Background() |
| // essentialcontactsService, err := essentialcontacts.NewService(ctx) |
| // |
| // In this example, Google Application Default Credentials are used for |
| // authentication. For information on how to create and obtain Application |
| // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. |
| // |
| // # Other authentication options |
| // |
| // To use an API key for authentication (note: some APIs do not support API |
| // keys), use [google.golang.org/api/option.WithAPIKey]: |
| // |
| // essentialcontactsService, err := essentialcontacts.NewService(ctx, option.WithAPIKey("AIza...")) |
| // |
| // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth |
| // flow, use [google.golang.org/api/option.WithTokenSource]: |
| // |
| // config := &oauth2.Config{...} |
| // // ... |
| // token, err := config.Exchange(ctx, ...) |
| // essentialcontactsService, err := essentialcontacts.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) |
| // |
| // See [google.golang.org/api/option.ClientOption] for details on options. |
| package essentialcontacts // import "google.golang.org/api/essentialcontacts/v1" |
| |
| import ( |
| "bytes" |
| "context" |
| "encoding/json" |
| "errors" |
| "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| "strconv" |
| "strings" |
| |
| googleapi "google.golang.org/api/googleapi" |
| internal "google.golang.org/api/internal" |
| gensupport "google.golang.org/api/internal/gensupport" |
| option "google.golang.org/api/option" |
| internaloption "google.golang.org/api/option/internaloption" |
| htransport "google.golang.org/api/transport/http" |
| ) |
| |
| // Always reference these packages, just in case the auto-generated code |
| // below doesn't. |
| var _ = bytes.NewBuffer |
| var _ = strconv.Itoa |
| var _ = fmt.Sprintf |
| var _ = json.NewDecoder |
| var _ = io.Copy |
| var _ = url.Parse |
| var _ = gensupport.MarshalJSON |
| var _ = googleapi.Version |
| var _ = errors.New |
| var _ = strings.Replace |
| var _ = context.Canceled |
| var _ = internaloption.WithDefaultEndpoint |
| var _ = internal.Version |
| |
| const apiId = "essentialcontacts:v1" |
| const apiName = "essentialcontacts" |
| const apiVersion = "v1" |
| const basePath = "https://essentialcontacts.googleapis.com/" |
| const basePathTemplate = "https://essentialcontacts.UNIVERSE_DOMAIN/" |
| const mtlsBasePath = "https://essentialcontacts.mtls.googleapis.com/" |
| |
| // OAuth2 scopes used by this API. |
| const ( |
| // See, edit, configure, and delete your Google Cloud data and see the email |
| // address for your Google Account. |
| CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" |
| ) |
| |
| // NewService creates a new Service. |
| func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { |
| scopesOption := internaloption.WithDefaultScopes( |
| "https://www.googleapis.com/auth/cloud-platform", |
| ) |
| // NOTE: prepend, so we don't override user-specified scopes. |
| opts = append([]option.ClientOption{scopesOption}, opts...) |
| opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) |
| opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) |
| opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) |
| opts = append(opts, internaloption.EnableNewAuthLibrary()) |
| client, endpoint, err := htransport.NewClient(ctx, opts...) |
| if err != nil { |
| return nil, err |
| } |
| s, err := New(client) |
| if err != nil { |
| return nil, err |
| } |
| if endpoint != "" { |
| s.BasePath = endpoint |
| } |
| return s, nil |
| } |
| |
| // New creates a new Service. It uses the provided http.Client for requests. |
| // |
| // Deprecated: please use NewService instead. |
| // To provide a custom HTTP client, use option.WithHTTPClient. |
| // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. |
| func New(client *http.Client) (*Service, error) { |
| if client == nil { |
| return nil, errors.New("client is nil") |
| } |
| s := &Service{client: client, BasePath: basePath} |
| s.Folders = NewFoldersService(s) |
| s.Organizations = NewOrganizationsService(s) |
| s.Projects = NewProjectsService(s) |
| return s, nil |
| } |
| |
| type Service struct { |
| client *http.Client |
| BasePath string // API endpoint base URL |
| UserAgent string // optional additional User-Agent fragment |
| |
| Folders *FoldersService |
| |
| Organizations *OrganizationsService |
| |
| Projects *ProjectsService |
| } |
| |
| func (s *Service) userAgent() string { |
| if s.UserAgent == "" { |
| return googleapi.UserAgent |
| } |
| return googleapi.UserAgent + " " + s.UserAgent |
| } |
| |
| func NewFoldersService(s *Service) *FoldersService { |
| rs := &FoldersService{s: s} |
| rs.Contacts = NewFoldersContactsService(s) |
| return rs |
| } |
| |
| type FoldersService struct { |
| s *Service |
| |
| Contacts *FoldersContactsService |
| } |
| |
| func NewFoldersContactsService(s *Service) *FoldersContactsService { |
| rs := &FoldersContactsService{s: s} |
| return rs |
| } |
| |
| type FoldersContactsService struct { |
| s *Service |
| } |
| |
| func NewOrganizationsService(s *Service) *OrganizationsService { |
| rs := &OrganizationsService{s: s} |
| rs.Contacts = NewOrganizationsContactsService(s) |
| return rs |
| } |
| |
| type OrganizationsService struct { |
| s *Service |
| |
| Contacts *OrganizationsContactsService |
| } |
| |
| func NewOrganizationsContactsService(s *Service) *OrganizationsContactsService { |
| rs := &OrganizationsContactsService{s: s} |
| return rs |
| } |
| |
| type OrganizationsContactsService struct { |
| s *Service |
| } |
| |
| func NewProjectsService(s *Service) *ProjectsService { |
| rs := &ProjectsService{s: s} |
| rs.Contacts = NewProjectsContactsService(s) |
| return rs |
| } |
| |
| type ProjectsService struct { |
| s *Service |
| |
| Contacts *ProjectsContactsService |
| } |
| |
| func NewProjectsContactsService(s *Service) *ProjectsContactsService { |
| rs := &ProjectsContactsService{s: s} |
| return rs |
| } |
| |
| type ProjectsContactsService struct { |
| s *Service |
| } |
| |
| // GoogleCloudEssentialcontactsV1ComputeContactsResponse: Response message for |
| // the ComputeContacts method. |
| type GoogleCloudEssentialcontactsV1ComputeContactsResponse struct { |
| // Contacts: All contacts for the resource that are subscribed to the specified |
| // notification categories, including contacts inherited from any parent |
| // resources. |
| Contacts []*GoogleCloudEssentialcontactsV1Contact `json:"contacts,omitempty"` |
| // NextPageToken: If there are more results than those appearing in this |
| // response, then `next_page_token` is included. To get the next set of |
| // results, call this method again using the value of `next_page_token` as |
| // `page_token` and the rest of the parameters the same as the original |
| // request. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the server. |
| googleapi.ServerResponse `json:"-"` |
| // ForceSendFields is a list of field names (e.g. "Contacts") to |
| // unconditionally include in API requests. By default, fields with empty or |
| // default values are omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more |
| // details. |
| ForceSendFields []string `json:"-"` |
| // NullFields is a list of field names (e.g. "Contacts") to include in API |
| // requests with the JSON null value. By default, fields with empty values are |
| // omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *GoogleCloudEssentialcontactsV1ComputeContactsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod GoogleCloudEssentialcontactsV1ComputeContactsResponse |
| return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) |
| } |
| |
| // GoogleCloudEssentialcontactsV1Contact: A contact that will receive |
| // notifications from Google Cloud. |
| type GoogleCloudEssentialcontactsV1Contact struct { |
| // Email: Required. The email address to send notifications to. The email |
| // address does not need to be a Google Account. |
| Email string `json:"email,omitempty"` |
| // LanguageTag: Required. The preferred language for notifications, as a ISO |
| // 639-1 language code. See Supported languages |
| // (https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) |
| // for a list of supported languages. |
| LanguageTag string `json:"languageTag,omitempty"` |
| // Name: Output only. The identifier for the contact. Format: |
| // {resource_type}/{resource_id}/contacts/{contact_id} |
| Name string `json:"name,omitempty"` |
| // NotificationCategorySubscriptions: Required. The categories of notifications |
| // that the contact will receive communications for. |
| // |
| // Possible values: |
| // "NOTIFICATION_CATEGORY_UNSPECIFIED" - Notification category is |
| // unrecognized or unspecified. |
| // "ALL" - All notifications related to the resource, including notifications |
| // pertaining to categories added in the future. |
| // "SUSPENSION" - Notifications related to imminent account suspension. |
| // "SECURITY" - Notifications related to security/privacy incidents, |
| // notifications, and vulnerabilities. |
| // "TECHNICAL" - Notifications related to technical events and issues such as |
| // outages, errors, or bugs. |
| // "BILLING" - Notifications related to billing and payments notifications, |
| // price updates, errors, or credits. |
| // "LEGAL" - Notifications related to enforcement actions, regulatory |
| // compliance, or government notices. |
| // "PRODUCT_UPDATES" - Notifications related to new versions, product terms |
| // updates, or deprecations. |
| // "TECHNICAL_INCIDENTS" - Child category of TECHNICAL. If assigned, |
| // technical incident notifications will go to these contacts instead of |
| // TECHNICAL. |
| NotificationCategorySubscriptions []string `json:"notificationCategorySubscriptions,omitempty"` |
| // ValidateTime: The last time the validation_state was updated, either |
| // manually or automatically. A contact is considered stale if its validation |
| // state was updated more than 1 year ago. |
| ValidateTime string `json:"validateTime,omitempty"` |
| // ValidationState: The validity of the contact. A contact is considered valid |
| // if it is the correct recipient for notifications for a particular resource. |
| // |
| // Possible values: |
| // "VALIDATION_STATE_UNSPECIFIED" - The validation state is unknown or |
| // unspecified. |
| // "VALID" - The contact is marked as valid. This is usually done manually by |
| // the contact admin. All new contacts begin in the valid state. |
| // "INVALID" - The contact is considered invalid. This may become the state |
| // if the contact's email is found to be unreachable. |
| ValidationState string `json:"validationState,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the server. |
| googleapi.ServerResponse `json:"-"` |
| // ForceSendFields is a list of field names (e.g. "Email") to unconditionally |
| // include in API requests. By default, fields with empty or default values are |
| // omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more |
| // details. |
| ForceSendFields []string `json:"-"` |
| // NullFields is a list of field names (e.g. "Email") to include in API |
| // requests with the JSON null value. By default, fields with empty values are |
| // omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *GoogleCloudEssentialcontactsV1Contact) MarshalJSON() ([]byte, error) { |
| type NoMethod GoogleCloudEssentialcontactsV1Contact |
| return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) |
| } |
| |
| // GoogleCloudEssentialcontactsV1ListContactsResponse: Response message for the |
| // ListContacts method. |
| type GoogleCloudEssentialcontactsV1ListContactsResponse struct { |
| // Contacts: The contacts for the specified resource. |
| Contacts []*GoogleCloudEssentialcontactsV1Contact `json:"contacts,omitempty"` |
| // NextPageToken: If there are more results than those appearing in this |
| // response, then `next_page_token` is included. To get the next set of |
| // results, call this method again using the value of `next_page_token` as |
| // `page_token` and the rest of the parameters the same as the original |
| // request. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the server. |
| googleapi.ServerResponse `json:"-"` |
| // ForceSendFields is a list of field names (e.g. "Contacts") to |
| // unconditionally include in API requests. By default, fields with empty or |
| // default values are omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more |
| // details. |
| ForceSendFields []string `json:"-"` |
| // NullFields is a list of field names (e.g. "Contacts") to include in API |
| // requests with the JSON null value. By default, fields with empty values are |
| // omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *GoogleCloudEssentialcontactsV1ListContactsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod GoogleCloudEssentialcontactsV1ListContactsResponse |
| return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) |
| } |
| |
| // GoogleCloudEssentialcontactsV1SendTestMessageRequest: Request message for |
| // the SendTestMessage method. |
| type GoogleCloudEssentialcontactsV1SendTestMessageRequest struct { |
| // Contacts: Required. The list of names of the contacts to send a test message |
| // to. Format: organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id} |
| Contacts []string `json:"contacts,omitempty"` |
| // NotificationCategory: Required. The notification category to send the test |
| // message for. All contacts must be subscribed to this category. |
| // |
| // Possible values: |
| // "NOTIFICATION_CATEGORY_UNSPECIFIED" - Notification category is |
| // unrecognized or unspecified. |
| // "ALL" - All notifications related to the resource, including notifications |
| // pertaining to categories added in the future. |
| // "SUSPENSION" - Notifications related to imminent account suspension. |
| // "SECURITY" - Notifications related to security/privacy incidents, |
| // notifications, and vulnerabilities. |
| // "TECHNICAL" - Notifications related to technical events and issues such as |
| // outages, errors, or bugs. |
| // "BILLING" - Notifications related to billing and payments notifications, |
| // price updates, errors, or credits. |
| // "LEGAL" - Notifications related to enforcement actions, regulatory |
| // compliance, or government notices. |
| // "PRODUCT_UPDATES" - Notifications related to new versions, product terms |
| // updates, or deprecations. |
| // "TECHNICAL_INCIDENTS" - Child category of TECHNICAL. If assigned, |
| // technical incident notifications will go to these contacts instead of |
| // TECHNICAL. |
| NotificationCategory string `json:"notificationCategory,omitempty"` |
| // ForceSendFields is a list of field names (e.g. "Contacts") to |
| // unconditionally include in API requests. By default, fields with empty or |
| // default values are omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more |
| // details. |
| ForceSendFields []string `json:"-"` |
| // NullFields is a list of field names (e.g. "Contacts") to include in API |
| // requests with the JSON null value. By default, fields with empty values are |
| // omitted from API requests. See |
| // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *GoogleCloudEssentialcontactsV1SendTestMessageRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod GoogleCloudEssentialcontactsV1SendTestMessageRequest |
| return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) |
| } |
| |
| // GoogleProtobufEmpty: A generic empty message that you can re-use to avoid |
| // defining duplicated empty messages in your APIs. A typical example is to use |
| // it as the request or the response type of an API method. For instance: |
| // service Foo { rpc Bar(google.protobuf.Empty) returns |
| // (google.protobuf.Empty); } |
| type GoogleProtobufEmpty struct { |
| // ServerResponse contains the HTTP response code and headers from the server. |
| googleapi.ServerResponse `json:"-"` |
| } |
| |
| type FoldersContactsComputeCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Compute: Lists all contacts for the resource that are subscribed to the |
| // specified notification categories, including contacts inherited from any |
| // parent resources. |
| // |
| // - parent: The name of the resource to compute contacts for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *FoldersContactsService) Compute(parent string) *FoldersContactsComputeCall { |
| c := &FoldersContactsComputeCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // NotificationCategories sets the optional parameter "notificationCategories": |
| // The categories of notifications to compute contacts for. If ALL is included |
| // in this list, contacts subscribed to any notification category will be |
| // returned. |
| // |
| // Possible values: |
| // |
| // "NOTIFICATION_CATEGORY_UNSPECIFIED" - Notification category is |
| // |
| // unrecognized or unspecified. |
| // |
| // "ALL" - All notifications related to the resource, including notifications |
| // |
| // pertaining to categories added in the future. |
| // |
| // "SUSPENSION" - Notifications related to imminent account suspension. |
| // "SECURITY" - Notifications related to security/privacy incidents, |
| // |
| // notifications, and vulnerabilities. |
| // |
| // "TECHNICAL" - Notifications related to technical events and issues such as |
| // |
| // outages, errors, or bugs. |
| // |
| // "BILLING" - Notifications related to billing and payments notifications, |
| // |
| // price updates, errors, or credits. |
| // |
| // "LEGAL" - Notifications related to enforcement actions, regulatory |
| // |
| // compliance, or government notices. |
| // |
| // "PRODUCT_UPDATES" - Notifications related to new versions, product terms |
| // |
| // updates, or deprecations. |
| // |
| // "TECHNICAL_INCIDENTS" - Child category of TECHNICAL. If assigned, |
| // |
| // technical incident notifications will go to these contacts instead of |
| // TECHNICAL. |
| func (c *FoldersContactsComputeCall) NotificationCategories(notificationCategories ...string) *FoldersContactsComputeCall { |
| c.urlParams_.SetMulti("notificationCategories", append([]string{}, notificationCategories...)) |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *FoldersContactsComputeCall) PageSize(pageSize int64) *FoldersContactsComputeCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *FoldersContactsComputeCall) PageToken(pageToken string) *FoldersContactsComputeCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsComputeCall) Fields(s ...googleapi.Field) *FoldersContactsComputeCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *FoldersContactsComputeCall) IfNoneMatch(entityTag string) *FoldersContactsComputeCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsComputeCall) Context(ctx context.Context) *FoldersContactsComputeCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsComputeCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsComputeCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts:compute") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.compute" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ComputeContactsResponse.ServerResponse.Header |
| // or (if a response was returned at all) in error.(*googleapi.Error).Header. |
| // Use googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *FoldersContactsComputeCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ComputeContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ComputeContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *FoldersContactsComputeCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ComputeContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type FoldersContactsCreateCall struct { |
| s *Service |
| parent string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Create: Adds a new contact for a resource. |
| // |
| // - parent: The resource to save this contact for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *FoldersContactsService) Create(parent string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *FoldersContactsCreateCall { |
| c := &FoldersContactsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsCreateCall) Fields(s ...googleapi.Field) *FoldersContactsCreateCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsCreateCall) Context(ctx context.Context) *FoldersContactsCreateCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsCreateCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsCreateCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.create" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *FoldersContactsCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type FoldersContactsDeleteCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Delete: Deletes a contact. |
| // |
| // - name: The name of the contact to delete. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *FoldersContactsService) Delete(name string) *FoldersContactsDeleteCall { |
| c := &FoldersContactsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsDeleteCall) Fields(s ...googleapi.Field) *FoldersContactsDeleteCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsDeleteCall) Context(ctx context.Context) *FoldersContactsDeleteCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsDeleteCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("DELETE", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.delete" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *FoldersContactsDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type FoldersContactsGetCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Gets a single contact. |
| // |
| // - name: The name of the contact to retrieve. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *FoldersContactsService) Get(name string) *FoldersContactsGetCall { |
| c := &FoldersContactsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsGetCall) Fields(s ...googleapi.Field) *FoldersContactsGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *FoldersContactsGetCall) IfNoneMatch(entityTag string) *FoldersContactsGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsGetCall) Context(ctx context.Context) *FoldersContactsGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.get" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *FoldersContactsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type FoldersContactsListCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists the contacts that have been set on a resource. |
| // |
| // - parent: The parent resource name. Format: organizations/{organization_id}, |
| // folders/{folder_id} or projects/{project_id}. |
| func (r *FoldersContactsService) List(parent string) *FoldersContactsListCall { |
| c := &FoldersContactsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *FoldersContactsListCall) PageSize(pageSize int64) *FoldersContactsListCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *FoldersContactsListCall) PageToken(pageToken string) *FoldersContactsListCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsListCall) Fields(s ...googleapi.Field) *FoldersContactsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *FoldersContactsListCall) IfNoneMatch(entityTag string) *FoldersContactsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsListCall) Context(ctx context.Context) *FoldersContactsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.list" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ListContactsResponse.ServerResponse.Header or |
| // (if a response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *FoldersContactsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ListContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ListContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *FoldersContactsListCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ListContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type FoldersContactsPatchCall struct { |
| s *Service |
| nameid string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Patch: Updates a contact. Note: A contact's email address cannot be changed. |
| // |
| // - name: Output only. The identifier for the contact. Format: |
| // {resource_type}/{resource_id}/contacts/{contact_id}. |
| func (r *FoldersContactsService) Patch(nameid string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *FoldersContactsPatchCall { |
| c := &FoldersContactsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.nameid = nameid |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // UpdateMask sets the optional parameter "updateMask": The update mask applied |
| // to the resource. For the `FieldMask` definition, see |
| // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask |
| func (c *FoldersContactsPatchCall) UpdateMask(updateMask string) *FoldersContactsPatchCall { |
| c.urlParams_.Set("updateMask", updateMask) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsPatchCall) Fields(s ...googleapi.Field) *FoldersContactsPatchCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsPatchCall) Context(ctx context.Context) *FoldersContactsPatchCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsPatchCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsPatchCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("PATCH", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.nameid, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.patch" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *FoldersContactsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type FoldersContactsSendTestMessageCall struct { |
| s *Service |
| resource string |
| googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // SendTestMessage: Allows a contact admin to send a test message to contact to |
| // verify that it has been configured correctly. |
| // |
| // - resource: The name of the resource to send the test message for. All |
| // contacts must either be set directly on this resource or inherited from |
| // another resource that is an ancestor of this one. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *FoldersContactsService) SendTestMessage(resource string, googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest) *FoldersContactsSendTestMessageCall { |
| c := &FoldersContactsSendTestMessageCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.resource = resource |
| c.googlecloudessentialcontactsv1sendtestmessagerequest = googlecloudessentialcontactsv1sendtestmessagerequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *FoldersContactsSendTestMessageCall) Fields(s ...googleapi.Field) *FoldersContactsSendTestMessageCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *FoldersContactsSendTestMessageCall) Context(ctx context.Context) *FoldersContactsSendTestMessageCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *FoldersContactsSendTestMessageCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *FoldersContactsSendTestMessageCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1sendtestmessagerequest) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}/contacts:sendTestMessage") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "resource": c.resource, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.folders.contacts.sendTestMessage" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *FoldersContactsSendTestMessageCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type OrganizationsContactsComputeCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Compute: Lists all contacts for the resource that are subscribed to the |
| // specified notification categories, including contacts inherited from any |
| // parent resources. |
| // |
| // - parent: The name of the resource to compute contacts for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *OrganizationsContactsService) Compute(parent string) *OrganizationsContactsComputeCall { |
| c := &OrganizationsContactsComputeCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // NotificationCategories sets the optional parameter "notificationCategories": |
| // The categories of notifications to compute contacts for. If ALL is included |
| // in this list, contacts subscribed to any notification category will be |
| // returned. |
| // |
| // Possible values: |
| // |
| // "NOTIFICATION_CATEGORY_UNSPECIFIED" - Notification category is |
| // |
| // unrecognized or unspecified. |
| // |
| // "ALL" - All notifications related to the resource, including notifications |
| // |
| // pertaining to categories added in the future. |
| // |
| // "SUSPENSION" - Notifications related to imminent account suspension. |
| // "SECURITY" - Notifications related to security/privacy incidents, |
| // |
| // notifications, and vulnerabilities. |
| // |
| // "TECHNICAL" - Notifications related to technical events and issues such as |
| // |
| // outages, errors, or bugs. |
| // |
| // "BILLING" - Notifications related to billing and payments notifications, |
| // |
| // price updates, errors, or credits. |
| // |
| // "LEGAL" - Notifications related to enforcement actions, regulatory |
| // |
| // compliance, or government notices. |
| // |
| // "PRODUCT_UPDATES" - Notifications related to new versions, product terms |
| // |
| // updates, or deprecations. |
| // |
| // "TECHNICAL_INCIDENTS" - Child category of TECHNICAL. If assigned, |
| // |
| // technical incident notifications will go to these contacts instead of |
| // TECHNICAL. |
| func (c *OrganizationsContactsComputeCall) NotificationCategories(notificationCategories ...string) *OrganizationsContactsComputeCall { |
| c.urlParams_.SetMulti("notificationCategories", append([]string{}, notificationCategories...)) |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *OrganizationsContactsComputeCall) PageSize(pageSize int64) *OrganizationsContactsComputeCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *OrganizationsContactsComputeCall) PageToken(pageToken string) *OrganizationsContactsComputeCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsComputeCall) Fields(s ...googleapi.Field) *OrganizationsContactsComputeCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *OrganizationsContactsComputeCall) IfNoneMatch(entityTag string) *OrganizationsContactsComputeCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsComputeCall) Context(ctx context.Context) *OrganizationsContactsComputeCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsComputeCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsComputeCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts:compute") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.compute" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ComputeContactsResponse.ServerResponse.Header |
| // or (if a response was returned at all) in error.(*googleapi.Error).Header. |
| // Use googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *OrganizationsContactsComputeCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ComputeContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ComputeContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *OrganizationsContactsComputeCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ComputeContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type OrganizationsContactsCreateCall struct { |
| s *Service |
| parent string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Create: Adds a new contact for a resource. |
| // |
| // - parent: The resource to save this contact for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *OrganizationsContactsService) Create(parent string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *OrganizationsContactsCreateCall { |
| c := &OrganizationsContactsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsCreateCall) Fields(s ...googleapi.Field) *OrganizationsContactsCreateCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsCreateCall) Context(ctx context.Context) *OrganizationsContactsCreateCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsCreateCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsCreateCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.create" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *OrganizationsContactsCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type OrganizationsContactsDeleteCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Delete: Deletes a contact. |
| // |
| // - name: The name of the contact to delete. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *OrganizationsContactsService) Delete(name string) *OrganizationsContactsDeleteCall { |
| c := &OrganizationsContactsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsContactsDeleteCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsDeleteCall) Context(ctx context.Context) *OrganizationsContactsDeleteCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsDeleteCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("DELETE", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.delete" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *OrganizationsContactsDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type OrganizationsContactsGetCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Gets a single contact. |
| // |
| // - name: The name of the contact to retrieve. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *OrganizationsContactsService) Get(name string) *OrganizationsContactsGetCall { |
| c := &OrganizationsContactsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsGetCall) Fields(s ...googleapi.Field) *OrganizationsContactsGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *OrganizationsContactsGetCall) IfNoneMatch(entityTag string) *OrganizationsContactsGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsGetCall) Context(ctx context.Context) *OrganizationsContactsGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.get" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *OrganizationsContactsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type OrganizationsContactsListCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists the contacts that have been set on a resource. |
| // |
| // - parent: The parent resource name. Format: organizations/{organization_id}, |
| // folders/{folder_id} or projects/{project_id}. |
| func (r *OrganizationsContactsService) List(parent string) *OrganizationsContactsListCall { |
| c := &OrganizationsContactsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *OrganizationsContactsListCall) PageSize(pageSize int64) *OrganizationsContactsListCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *OrganizationsContactsListCall) PageToken(pageToken string) *OrganizationsContactsListCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsListCall) Fields(s ...googleapi.Field) *OrganizationsContactsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *OrganizationsContactsListCall) IfNoneMatch(entityTag string) *OrganizationsContactsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsListCall) Context(ctx context.Context) *OrganizationsContactsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.list" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ListContactsResponse.ServerResponse.Header or |
| // (if a response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *OrganizationsContactsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ListContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ListContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *OrganizationsContactsListCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ListContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type OrganizationsContactsPatchCall struct { |
| s *Service |
| nameid string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Patch: Updates a contact. Note: A contact's email address cannot be changed. |
| // |
| // - name: Output only. The identifier for the contact. Format: |
| // {resource_type}/{resource_id}/contacts/{contact_id}. |
| func (r *OrganizationsContactsService) Patch(nameid string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *OrganizationsContactsPatchCall { |
| c := &OrganizationsContactsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.nameid = nameid |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // UpdateMask sets the optional parameter "updateMask": The update mask applied |
| // to the resource. For the `FieldMask` definition, see |
| // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask |
| func (c *OrganizationsContactsPatchCall) UpdateMask(updateMask string) *OrganizationsContactsPatchCall { |
| c.urlParams_.Set("updateMask", updateMask) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsPatchCall) Fields(s ...googleapi.Field) *OrganizationsContactsPatchCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsPatchCall) Context(ctx context.Context) *OrganizationsContactsPatchCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsPatchCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsPatchCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("PATCH", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.nameid, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.patch" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *OrganizationsContactsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type OrganizationsContactsSendTestMessageCall struct { |
| s *Service |
| resource string |
| googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // SendTestMessage: Allows a contact admin to send a test message to contact to |
| // verify that it has been configured correctly. |
| // |
| // - resource: The name of the resource to send the test message for. All |
| // contacts must either be set directly on this resource or inherited from |
| // another resource that is an ancestor of this one. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *OrganizationsContactsService) SendTestMessage(resource string, googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest) *OrganizationsContactsSendTestMessageCall { |
| c := &OrganizationsContactsSendTestMessageCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.resource = resource |
| c.googlecloudessentialcontactsv1sendtestmessagerequest = googlecloudessentialcontactsv1sendtestmessagerequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *OrganizationsContactsSendTestMessageCall) Fields(s ...googleapi.Field) *OrganizationsContactsSendTestMessageCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *OrganizationsContactsSendTestMessageCall) Context(ctx context.Context) *OrganizationsContactsSendTestMessageCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *OrganizationsContactsSendTestMessageCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *OrganizationsContactsSendTestMessageCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1sendtestmessagerequest) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}/contacts:sendTestMessage") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "resource": c.resource, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.organizations.contacts.sendTestMessage" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *OrganizationsContactsSendTestMessageCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type ProjectsContactsComputeCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Compute: Lists all contacts for the resource that are subscribed to the |
| // specified notification categories, including contacts inherited from any |
| // parent resources. |
| // |
| // - parent: The name of the resource to compute contacts for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *ProjectsContactsService) Compute(parent string) *ProjectsContactsComputeCall { |
| c := &ProjectsContactsComputeCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // NotificationCategories sets the optional parameter "notificationCategories": |
| // The categories of notifications to compute contacts for. If ALL is included |
| // in this list, contacts subscribed to any notification category will be |
| // returned. |
| // |
| // Possible values: |
| // |
| // "NOTIFICATION_CATEGORY_UNSPECIFIED" - Notification category is |
| // |
| // unrecognized or unspecified. |
| // |
| // "ALL" - All notifications related to the resource, including notifications |
| // |
| // pertaining to categories added in the future. |
| // |
| // "SUSPENSION" - Notifications related to imminent account suspension. |
| // "SECURITY" - Notifications related to security/privacy incidents, |
| // |
| // notifications, and vulnerabilities. |
| // |
| // "TECHNICAL" - Notifications related to technical events and issues such as |
| // |
| // outages, errors, or bugs. |
| // |
| // "BILLING" - Notifications related to billing and payments notifications, |
| // |
| // price updates, errors, or credits. |
| // |
| // "LEGAL" - Notifications related to enforcement actions, regulatory |
| // |
| // compliance, or government notices. |
| // |
| // "PRODUCT_UPDATES" - Notifications related to new versions, product terms |
| // |
| // updates, or deprecations. |
| // |
| // "TECHNICAL_INCIDENTS" - Child category of TECHNICAL. If assigned, |
| // |
| // technical incident notifications will go to these contacts instead of |
| // TECHNICAL. |
| func (c *ProjectsContactsComputeCall) NotificationCategories(notificationCategories ...string) *ProjectsContactsComputeCall { |
| c.urlParams_.SetMulti("notificationCategories", append([]string{}, notificationCategories...)) |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *ProjectsContactsComputeCall) PageSize(pageSize int64) *ProjectsContactsComputeCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *ProjectsContactsComputeCall) PageToken(pageToken string) *ProjectsContactsComputeCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsComputeCall) Fields(s ...googleapi.Field) *ProjectsContactsComputeCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *ProjectsContactsComputeCall) IfNoneMatch(entityTag string) *ProjectsContactsComputeCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsComputeCall) Context(ctx context.Context) *ProjectsContactsComputeCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsComputeCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsComputeCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts:compute") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.compute" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ComputeContactsResponse.ServerResponse.Header |
| // or (if a response was returned at all) in error.(*googleapi.Error).Header. |
| // Use googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *ProjectsContactsComputeCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ComputeContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ComputeContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *ProjectsContactsComputeCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ComputeContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type ProjectsContactsCreateCall struct { |
| s *Service |
| parent string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Create: Adds a new contact for a resource. |
| // |
| // - parent: The resource to save this contact for. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *ProjectsContactsService) Create(parent string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *ProjectsContactsCreateCall { |
| c := &ProjectsContactsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsCreateCall) Fields(s ...googleapi.Field) *ProjectsContactsCreateCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsCreateCall) Context(ctx context.Context) *ProjectsContactsCreateCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsCreateCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsCreateCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.create" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *ProjectsContactsCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type ProjectsContactsDeleteCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Delete: Deletes a contact. |
| // |
| // - name: The name of the contact to delete. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *ProjectsContactsService) Delete(name string) *ProjectsContactsDeleteCall { |
| c := &ProjectsContactsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsDeleteCall) Fields(s ...googleapi.Field) *ProjectsContactsDeleteCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsDeleteCall) Context(ctx context.Context) *ProjectsContactsDeleteCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsDeleteCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("DELETE", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.delete" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *ProjectsContactsDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type ProjectsContactsGetCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Gets a single contact. |
| // |
| // - name: The name of the contact to retrieve. Format: |
| // organizations/{organization_id}/contacts/{contact_id}, |
| // folders/{folder_id}/contacts/{contact_id} or |
| // projects/{project_id}/contacts/{contact_id}. |
| func (r *ProjectsContactsService) Get(name string) *ProjectsContactsGetCall { |
| c := &ProjectsContactsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsGetCall) Fields(s ...googleapi.Field) *ProjectsContactsGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *ProjectsContactsGetCall) IfNoneMatch(entityTag string) *ProjectsContactsGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsGetCall) Context(ctx context.Context) *ProjectsContactsGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.get" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *ProjectsContactsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type ProjectsContactsListCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists the contacts that have been set on a resource. |
| // |
| // - parent: The parent resource name. Format: organizations/{organization_id}, |
| // folders/{folder_id} or projects/{project_id}. |
| func (r *ProjectsContactsService) List(parent string) *ProjectsContactsListCall { |
| c := &ProjectsContactsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number of |
| // results to return from this request. Non-positive values are ignored. The |
| // presence of `next_page_token` in the response indicates that more results |
| // might be available. If not specified, the default page_size is 100. |
| func (c *ProjectsContactsListCall) PageSize(pageSize int64) *ProjectsContactsListCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": If present, retrieves the |
| // next batch of results from the preceding call to this method. `page_token` |
| // must be the value of `next_page_token` from the previous response. The |
| // values of other method parameters should be identical to those in the |
| // previous call. |
| func (c *ProjectsContactsListCall) PageToken(pageToken string) *ProjectsContactsListCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsListCall) Fields(s ...googleapi.Field) *ProjectsContactsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets an optional parameter which makes the operation fail if the |
| // object's ETag matches the given value. This is useful for getting updates |
| // only after the object has changed since the last request. |
| func (c *ProjectsContactsListCall) IfNoneMatch(entityTag string) *ProjectsContactsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsListCall) Context(ctx context.Context) *ProjectsContactsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/contacts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.list" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1ListContactsResponse.ServerResponse.Header or |
| // (if a response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *ProjectsContactsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1ListContactsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1ListContactsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *ProjectsContactsListCall) Pages(ctx context.Context, f func(*GoogleCloudEssentialcontactsV1ListContactsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| type ProjectsContactsPatchCall struct { |
| s *Service |
| nameid string |
| googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Patch: Updates a contact. Note: A contact's email address cannot be changed. |
| // |
| // - name: Output only. The identifier for the contact. Format: |
| // {resource_type}/{resource_id}/contacts/{contact_id}. |
| func (r *ProjectsContactsService) Patch(nameid string, googlecloudessentialcontactsv1contact *GoogleCloudEssentialcontactsV1Contact) *ProjectsContactsPatchCall { |
| c := &ProjectsContactsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.nameid = nameid |
| c.googlecloudessentialcontactsv1contact = googlecloudessentialcontactsv1contact |
| return c |
| } |
| |
| // UpdateMask sets the optional parameter "updateMask": The update mask applied |
| // to the resource. For the `FieldMask` definition, see |
| // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask |
| func (c *ProjectsContactsPatchCall) UpdateMask(updateMask string) *ProjectsContactsPatchCall { |
| c.urlParams_.Set("updateMask", updateMask) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsPatchCall) Fields(s ...googleapi.Field) *ProjectsContactsPatchCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsPatchCall) Context(ctx context.Context) *ProjectsContactsPatchCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsPatchCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsPatchCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1contact) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("PATCH", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.nameid, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.patch" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleCloudEssentialcontactsV1Contact.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was because |
| // http.StatusNotModified was returned. |
| func (c *ProjectsContactsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudEssentialcontactsV1Contact, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleCloudEssentialcontactsV1Contact{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |
| |
| type ProjectsContactsSendTestMessageCall struct { |
| s *Service |
| resource string |
| googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // SendTestMessage: Allows a contact admin to send a test message to contact to |
| // verify that it has been configured correctly. |
| // |
| // - resource: The name of the resource to send the test message for. All |
| // contacts must either be set directly on this resource or inherited from |
| // another resource that is an ancestor of this one. Format: |
| // organizations/{organization_id}, folders/{folder_id} or |
| // projects/{project_id}. |
| func (r *ProjectsContactsService) SendTestMessage(resource string, googlecloudessentialcontactsv1sendtestmessagerequest *GoogleCloudEssentialcontactsV1SendTestMessageRequest) *ProjectsContactsSendTestMessageCall { |
| c := &ProjectsContactsSendTestMessageCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.resource = resource |
| c.googlecloudessentialcontactsv1sendtestmessagerequest = googlecloudessentialcontactsv1sendtestmessagerequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| // details. |
| func (c *ProjectsContactsSendTestMessageCall) Fields(s ...googleapi.Field) *ProjectsContactsSendTestMessageCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. |
| func (c *ProjectsContactsSendTestMessageCall) Context(ctx context.Context) *ProjectsContactsSendTestMessageCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns a http.Header that can be modified by the caller to add |
| // headers to the request. |
| func (c *ProjectsContactsSendTestMessageCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsContactsSendTestMessageCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudessentialcontactsv1sendtestmessagerequest) |
| if err != nil { |
| return nil, err |
| } |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}/contacts:sendTestMessage") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "resource": c.resource, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "essentialcontacts.projects.contacts.sendTestMessage" call. |
| // Any non-2xx status code is an error. Response headers are in either |
| // *GoogleProtobufEmpty.ServerResponse.Header or (if a response was returned at |
| // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified was |
| // returned. |
| func (c *ProjectsContactsSendTestMessageCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, gensupport.WrapError(&googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| }) |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, gensupport.WrapError(err) |
| } |
| ret := &GoogleProtobufEmpty{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| } |