<commit_before><%
  product_name = object.__product.name
  has_project = object.base_url.include?("{{project}}")
-%>
<%= lines(autogen_notice(:go, pwd)) -%>
package google

import (
  "fmt"
)

type <%= product_name -%>OperationWaiter struct {
  Config    *Config
  UserAgent string
<% if has_project -%>
  Project string
<% end -%>
<%  if object.__product.operation_retry -%>
	retryCount int
<% end -%>
  CommonOperationWaiter
}

func (w *<%= product_name -%>OperationWaiter) QueryOp() (interface{}, error) {
  if w == nil {
    return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
  }
  // Returns the proper get.
  url := fmt.Sprintf("<%= [object.__product.base_url, async.operation.base_url].flatten.join.gsub('{{op_id}}', '%s') -%>", w.CommonOperationWaiter.Op.Name)

  return sendRequest(w.Config, "GET", <% if has_project %>w.Project<% else %>""<% end %>, url, w.UserAgent, nil<%= object.error_retry_predicates ? ", " + object.error_retry_predicates.join(',') : "" -%>)
}

<%  if object.__product.operation_retry -%>
func (w *<%= product_name -%>OperationWaiter) IsRetryable(err error) bool {
	<%= lines(compile(pwd + '/' + object.__product.operation_retry)) -%>
}
<% end -%>


func create<%= product_name %>Waiter(config *Config, op map[string]interface{}, <% if has_project -%> project, <% end -%> activity, userAgent string) (*<%=product_name%>OperationWaiter, error) {
  w := &<%= product_name -%>OperationWaiter{
    Config:    config,
    UserAgent: userAgent,
<% if has_project -%>
    Project: project,
<% end -%>
  }
  if err := w.CommonOperationWaiter.SetOp(op); err != nil {
    return nil, err
  }
  return w, nil
}
<commit_msg>Operation polling now supports custom endpoints (#5610)<commit_after><%
  product_name = object.__product.name
  has_project = object.base_url.include?("{{project}}")
-%>
<%= lines(autogen_notice(:go, pwd)) -%>
package google

import (
  "fmt"
)

type <%= product_name -%>OperationWaiter struct {
  Config    *Config
  UserAgent string
<% if has_project -%>
  Project string
<% end -%>
<%  if object.__product.operation_retry -%>
	retryCount int
<% end -%>
  CommonOperationWaiter
}

func (w *<%= product_name -%>OperationWaiter) QueryOp() (interface{}, error) {
  if w == nil {
    return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
  }
  // Returns the proper get.
  url := fmt.Sprintf("%s<%= [async.operation.base_url].flatten.join.gsub('{{op_id}}', '%s')-%>", w.Config.<%= product_name -%>BasePath, w.CommonOperationWaiter.Op.Name)

  return sendRequest(w.Config, "GET", <% if has_project %>w.Project<% else %>""<% end %>, url, w.UserAgent, nil<%= object.error_retry_predicates ? ", " + object.error_retry_predicates.join(',') : "" -%>)
}

<%  if object.__product.operation_retry -%>
func (w *<%= product_name -%>OperationWaiter) IsRetryable(err error) bool {
	<%= lines(compile(pwd + '/' + object.__product.operation_retry)) -%>
}
<% end -%>


func create<%= product_name %>Waiter(config *Config, op map[string]interface{}, <% if has_project -%> project, <% end -%> activity, userAgent string) (*<%=product_name%>OperationWaiter, error) {
  w := &<%= product_name -%>OperationWaiter{
    Config:    config,
    UserAgent: userAgent,
<% if has_project -%>
    Project: project,
<% end -%>
  }
  if err := w.CommonOperationWaiter.SetOp(op); err != nil {
    return nil, err
  }
  return w, nil
}

{'fraction_non_alphanumeric': 0.18644569399230543, 'fraction_numerical': 0.0011837821840781297, 'mean_word_length': 4.3061224489795915, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4320347', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1185, 'n_words': 254}