mybusinessqanda

package
v0.213.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package mybusinessqanda provides access to the My Business Q&A API.

For product documentation, see: https://developers.google.com/my-business/

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/mybusinessqanda/v1"
...
ctx := context.Background()
mybusinessqandaService, err := mybusinessqanda.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:

mybusinessqandaService, err := mybusinessqanda.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, ...)
mybusinessqandaService, err := mybusinessqanda.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See google.golang.org/api/option.ClientOption for details on options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	// Author: Output only. The author of the answer. Will only be set during list
	// operations.
	Author *Author `json:"author,omitempty"`
	// CreateTime: Output only. The timestamp for when the answer was written. Only
	// retrieved during ListResponse fetching.
	CreateTime string `json:"createTime,omitempty"`
	// Name: Output only. The unique name for the answer
	// locations/*/questions/*/answers/*
	Name string `json:"name,omitempty"`
	// Text: Required. The text of the answer. It should contain at least one
	// non-whitespace character. The maximum length is 4096 characters.
	Text string `json:"text,omitempty"`
	// UpdateTime: Output only. The timestamp for when the answer was last
	// modified.
	UpdateTime string `json:"updateTime,omitempty"`
	// UpvoteCount: Output only. The number of upvotes for the answer.
	UpvoteCount int64 `json:"upvoteCount,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Author") 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. "Author") 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:"-"`
}

Answer: Represents an answer to a question

func (Answer) MarshalJSON

func (s Answer) MarshalJSON() ([]byte, error)

type Author

type Author struct {
	// DisplayName: The display name of the user
	DisplayName string `json:"displayName,omitempty"`
	// ProfilePhotoUri: The profile photo URI of the user.
	ProfilePhotoUri string `json:"profilePhotoUri,omitempty"`
	// Type: The type of user the author is.
	//
	// Possible values:
	//   "AUTHOR_TYPE_UNSPECIFIED" - This should not be used.
	//   "REGULAR_USER" - A regular user.
	//   "LOCAL_GUIDE" - A Local Guide
	//   "MERCHANT" - The owner/manager of the location
	Type string `json:"type,omitempty"`
	// ForceSendFields is a list of field names (e.g. "DisplayName") 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. "DisplayName") 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:"-"`
}

Author: Represents the author of a question or answer

func (Author) MarshalJSON

func (s Author) MarshalJSON() ([]byte, error)

type Empty

type Empty struct {
	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
}

Empty: 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 ListAnswersResponse

type ListAnswersResponse struct {
	// Answers: The requested answers.
	Answers []*Answer `json:"answers,omitempty"`
	// NextPageToken: If the number of answers exceeds the requested max page size,
	// this field is populated with a token to fetch the next page of answers on a
	// subsequent call. If there are no more answers, this field is not present in
	// the response.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// TotalSize: The total number of answers posted for this question across all
	// pages.
	TotalSize int64 `json:"totalSize,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Answers") 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. "Answers") 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:"-"`
}

ListAnswersResponse: Response message for QuestionsAndAnswers.ListAnswers

func (ListAnswersResponse) MarshalJSON

func (s ListAnswersResponse) MarshalJSON() ([]byte, error)

type ListQuestionsResponse

type ListQuestionsResponse struct {
	// NextPageToken: If the number of questions exceeds the requested max page
	// size, this field is populated with a token to fetch the next page of
	// questions on a subsequent call. If there are no more questions, this field
	// is not present in the response.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// Questions: The requested questions,
	Questions []*Question `json:"questions,omitempty"`
	// TotalSize: The total number of questions posted for this location across all
	// pages.
	TotalSize int64 `json:"totalSize,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "NextPageToken") 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. "NextPageToken") 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:"-"`
}

ListQuestionsResponse: Response message for QuestionsAndAnswers.ListQuestions

func (ListQuestionsResponse) MarshalJSON

func (s ListQuestionsResponse) MarshalJSON() ([]byte, error)

type LocationsQuestionsAnswersDeleteCall added in v0.75.0

type LocationsQuestionsAnswersDeleteCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsAnswersDeleteCall) Context added in v0.75.0

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsAnswersDeleteCall) Do added in v0.75.0

Do executes the "mybusinessqanda.locations.questions.answers.delete" call. Any non-2xx status code is an error. Response headers are in either *Empty.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 (*LocationsQuestionsAnswersDeleteCall) Fields added in v0.75.0

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsAnswersDeleteCall) Header added in v0.75.0

Header returns a http.Header that can be modified by the caller to add headers to the request.

type LocationsQuestionsAnswersListCall

type LocationsQuestionsAnswersListCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsAnswersListCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsAnswersListCall) Do

Do executes the "mybusinessqanda.locations.questions.answers.list" call. Any non-2xx status code is an error. Response headers are in either *ListAnswersResponse.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 (*LocationsQuestionsAnswersListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsAnswersListCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*LocationsQuestionsAnswersListCall) IfNoneMatch

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 (*LocationsQuestionsAnswersListCall) OrderBy

OrderBy sets the optional parameter "orderBy": The order to return the answers. Valid options include 'update_time desc' and 'upvote_count desc', which will return the answers sorted descendingly by the requested field. The default sort order is 'update_time desc'.

func (*LocationsQuestionsAnswersListCall) PageSize

PageSize sets the optional parameter "pageSize": How many answers to fetch per page. The default and maximum `page_size` values are 10.

func (*LocationsQuestionsAnswersListCall) PageToken

PageToken sets the optional parameter "pageToken": If specified, the next page of answers is retrieved.

func (*LocationsQuestionsAnswersListCall) Pages

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.

type LocationsQuestionsAnswersService

type LocationsQuestionsAnswersService struct {
	// contains filtered or unexported fields
}

func NewLocationsQuestionsAnswersService

func NewLocationsQuestionsAnswersService(s *Service) *LocationsQuestionsAnswersService

func (*LocationsQuestionsAnswersService) Delete added in v0.75.0

Delete: Deletes the answer written by the current user to a question.

- name: The name of the question to delete an answer for.

func (*LocationsQuestionsAnswersService) List

List: Returns the paginated list of answers for a specified question.

- parent: The name of the question to fetch answers for.

func (*LocationsQuestionsAnswersService) Upsert

Upsert: Creates an answer or updates the existing answer written by the user for the specified question. A user can only create one answer per question.

- parent: The name of the question to write an answer for.

type LocationsQuestionsAnswersUpsertCall

type LocationsQuestionsAnswersUpsertCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsAnswersUpsertCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsAnswersUpsertCall) Do

Do executes the "mybusinessqanda.locations.questions.answers.upsert" call. Any non-2xx status code is an error. Response headers are in either *Answer.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 (*LocationsQuestionsAnswersUpsertCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsAnswersUpsertCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

type LocationsQuestionsCreateCall

type LocationsQuestionsCreateCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsCreateCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsCreateCall) Do

Do executes the "mybusinessqanda.locations.questions.create" call. Any non-2xx status code is an error. Response headers are in either *Question.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 (*LocationsQuestionsCreateCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsCreateCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

type LocationsQuestionsDeleteCall

type LocationsQuestionsDeleteCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsDeleteCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsDeleteCall) Do

Do executes the "mybusinessqanda.locations.questions.delete" call. Any non-2xx status code is an error. Response headers are in either *Empty.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 (*LocationsQuestionsDeleteCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsDeleteCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

type LocationsQuestionsListCall

type LocationsQuestionsListCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsListCall) AnswersPerQuestion

func (c *LocationsQuestionsListCall) AnswersPerQuestion(answersPerQuestion int64) *LocationsQuestionsListCall

AnswersPerQuestion sets the optional parameter "answersPerQuestion": How many answers to fetch per question. The default and maximum `answers_per_question` values are 10.

func (*LocationsQuestionsListCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsListCall) Do

Do executes the "mybusinessqanda.locations.questions.list" call. Any non-2xx status code is an error. Response headers are in either *ListQuestionsResponse.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 (*LocationsQuestionsListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsListCall) Filter

Filter sets the optional parameter "filter": A filter constraining the questions to return. The only filter currently supported is "ignore_answered=true"

func (*LocationsQuestionsListCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*LocationsQuestionsListCall) IfNoneMatch

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 (*LocationsQuestionsListCall) OrderBy

OrderBy sets the optional parameter "orderBy": The order to return the questions. Valid options include 'update_time desc' and 'upvote_count desc', which will return the questions sorted descendingly by the requested field. The default sort order is 'update_time desc'.

func (*LocationsQuestionsListCall) PageSize

PageSize sets the optional parameter "pageSize": How many questions to fetch per page. The default and maximum `page_size` values are 10.

func (*LocationsQuestionsListCall) PageToken

PageToken sets the optional parameter "pageToken": If specified, the next page of questions is retrieved.

func (*LocationsQuestionsListCall) Pages

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.

type LocationsQuestionsPatchCall

type LocationsQuestionsPatchCall struct {
	// contains filtered or unexported fields
}

func (*LocationsQuestionsPatchCall) Context

Context sets the context to be used in this call's Do method.

func (*LocationsQuestionsPatchCall) Do

Do executes the "mybusinessqanda.locations.questions.patch" call. Any non-2xx status code is an error. Response headers are in either *Question.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 (*LocationsQuestionsPatchCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*LocationsQuestionsPatchCall) Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*LocationsQuestionsPatchCall) UpdateMask

UpdateMask sets the optional parameter "updateMask": Required. The specific fields to update. Only question text can be updated.

type LocationsQuestionsService

type LocationsQuestionsService struct {
	Answers *LocationsQuestionsAnswersService
	// contains filtered or unexported fields
}

func NewLocationsQuestionsService

func NewLocationsQuestionsService(s *Service) *LocationsQuestionsService

func (*LocationsQuestionsService) Create

Create: Adds a question for the specified location.

- parent: The name of the location to write a question for.

func (*LocationsQuestionsService) Delete

Delete: Deletes a specific question written by the current user.

- name: The name of the question to delete.

func (*LocationsQuestionsService) List

List: Returns the paginated list of questions and some of its answers for a specified location. This operation is only valid if the specified location is verified.

- parent: The name of the location to fetch questions for.

func (*LocationsQuestionsService) Patch

Patch: Updates a specific question written by the current user.

  • name: Immutable. The unique name for the question. locations/*/questions/* This field will be ignored if set during question creation.

type LocationsService

type LocationsService struct {
	Questions *LocationsQuestionsService
	// contains filtered or unexported fields
}

func NewLocationsService

func NewLocationsService(s *Service) *LocationsService

type Question

type Question struct {
	// Author: Output only. The author of the question.
	Author *Author `json:"author,omitempty"`
	// CreateTime: Output only. The timestamp for when the question was written.
	CreateTime string `json:"createTime,omitempty"`
	// Name: Immutable. The unique name for the question. locations/*/questions/*
	// This field will be ignored if set during question creation.
	Name string `json:"name,omitempty"`
	// Text: Required. The text of the question. It should contain at least three
	// words and the total length should be greater than or equal to 10 characters.
	// The maximum length is 4096 characters.
	Text string `json:"text,omitempty"`
	// TopAnswers: Output only. A list of answers to the question, sorted by
	// upvotes. This may not be a complete list of answers depending on the request
	// parameters (answers_per_question)
	TopAnswers []*Answer `json:"topAnswers,omitempty"`
	// TotalAnswerCount: Output only. The total number of answers posted for this
	// question.
	TotalAnswerCount int64 `json:"totalAnswerCount,omitempty"`
	// UpdateTime: Output only. The timestamp for when the question was last
	// modified.
	UpdateTime string `json:"updateTime,omitempty"`
	// UpvoteCount: Output only. The number of upvotes for the question.
	UpvoteCount int64 `json:"upvoteCount,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Author") 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. "Author") 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:"-"`
}

Question: Represents a single question and some of its answers.

func (Question) MarshalJSON

func (s Question) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Locations *LocationsService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

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 NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type UpsertAnswerRequest

type UpsertAnswerRequest struct {
	// Answer: Required. The new answer.
	Answer *Answer `json:"answer,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Answer") 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. "Answer") 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:"-"`
}

UpsertAnswerRequest: Request message for QuestionsAndAnswers.UpsertAnswer

func (UpsertAnswerRequest) MarshalJSON

func (s UpsertAnswerRequest) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL