yext

package module
v0.0.0-...-0808aa4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 17 Imported by: 0

README

yext-go

Go client for the Yext API

GoDoc Build Status

Documentation

Overview

Package yext provides bindings for Yext Platform API.

For full Platform API documentation visit https://www.yext.com/support/platform-api/

Usage

Create an authenticated client

// `user`, `pass`, and `customerid` should be populated with
// account credentials for a user that has the "API Access" role.
client := yext.NewClient(yext.NewDefaultConfig().WithCredentials("[user]", "[pass]", "[customerid]"))

List all locations

locs, err := client.LocationService.List()

Fetch a single location

loc, err := client.LocationService.Get("JB-01")

Create a new location (see full documentation for required fields)

loc := &yext.Location{
	Id: yext.String("JB-02"),
	Name: yext.String("Joe's Bake Shop"),
}
loc, err := client.LocationService.Create(loc)

Edit an existing location

loc := &yext.Location{
	Id: yext.String("JB-02"),
	Name: yext.String("Joe's Pastry Emporium"),
}
loc, err := client.LocationService.Edit(loc)

Configuration

The behavior of the API client can be controlled with a Config instance. The Config type exposes chainable utility methods to make construction simpler.

// Config with sane settings (prod host, 3 retries)
yext.NewDefaultConfig()

// Set authentication parameters
yext.NewDefaultConfig().WithCredentials("[user]", "[password]", "[customerid]")

// Set authentication parameters from environment
yext.NewDefaultConfig().WithEnvCredentials()

// Communicate with Yext Sandbox
yext.NewConfig().WithSandboxHost()

Models

In order to support partial object updates, many of the struct attributes are represented as pointers in order to differentiate between "not-present" and "zero-valued". Helpers are provided to make it easier to work with the pointers:

l := &yext.Location{
	Id: yext.String("JB-01"),
	SuppressAddress: yext.Bool(true),
	DisplayLat: yext.Float(38.813),
	Keywords: yext.Strings([]string{"pastries", "bakery", "food"})
}

In addition, accessors are provided to make extracting data from the model objects simpler:

l.GetId() // => "JB-01"
l.GetSuppressAddress() // => true
l.GetDisplayLat() // => 38.813
l.GetKeywords() // => ["pastries", "bakery", "food"]

Error handling

Errors returned from the API are surfaced as ErrorResponse objects. The ErrorReponse contains a list of encountered errors, each with a Message and Code, as well as the raw http.Response object. A full list a expected errors can be found here: https://www.yext.com/support/platform-api/#API_Conventions_and_Authentication.htm

_, err := client.LocationService.Create(&yext.Location{})

// {"errors": [{"code": "123", message": "Id cannot be blank"}]}

One exception to the above is 404 "Not Found" errors which are returned as the named error `ResourceNotFound`.

All non-4xx errors (transport, API 5xx responses, etc.) are elligible for automatic retries.

Services

Most of the functionality within the API is exposed via domain-specific services available under the `Client` object. For example, if you are interacting with Locations, use the Client instance's LocationService. If you need to interact with Users, you'd use the UserService.

  • CustomFieldService
  • ECLService
  • FolderService
  • LicenseService
  • LocationService
  • UserService

Each service provides a set of common data-access functions that you can use to interact with objects under the service's domain.

Get() // Fetch by known ID
List() // Fetch all
Edit() // Update and return API version
Create() // Create and return API version

Where appropriate, services will expose additional, domain-specific functionality.

Index

Constants

View Source
const (
	ACCESS_CUSTOMER = AccessOn("CUSTOMER")
	ACCESS_FOLDER   = AccessOn("FOLDER")
	ACCESS_LOCATION = AccessOn("LOCATION")
)
View Source
const (
	SandboxHost    string = "api-sandbox.yext.com"
	ProductionHost string = "api.yext.com"
)
View Source
const (
	CUSTOMFIELDTYPE_YESNO          = "BOOLEAN"
	CUSTOMFIELDTYPE_SINGLELINETEXT = "TEXT"
	CUSTOMFIELDTYPE_MULTILINETEXT  = "MULTILINETEXT"
	CUSTOMFIELDTYPE_SINGLEOPTION   = "SINGLEOPTION"
	CUSTOMFIELDTYPE_URL            = "URL"
	CUSTOMFIELDTYPE_DATE           = "DATE"
	CUSTOMFIELDTYPE_NUMBER         = "NUMBER"
	CUSTOMFIELDTYPE_MULTIOPTION    = "MULTIOPTION"
	CUSTOMFIELDTYPE_TEXTLIST       = "TEXTLIST"
	CUSTOMFIELDTYPE_PHOTO          = "PHOTO"
	CUSTOMFIELDTYPE_GALLERY        = "GALLERY"
	CUSTOMFIELDTYPE_VIDEO          = "VIDEO"
	CUSTOMFIELDTYPE_HOURS          = "HOURS"
	CUSTOMFIELDTYPE_CUSTOMHOURS    = "HOURS"
)
View Source
const (
	CUSTOMERS_PATH string = "customers"
)

Variables

View Source
var DefaultBackoffPolicy = BackoffPolicy{
	[]int{0, 0, 1000, 5000},
}

Default is a backoff policy ranging up to 5 seconds.

View Source
var ResourceNotFound = errors.New("Resource not found")

Functions

func BioItemCompare

func BioItemCompare(itemA Bio, itemB Bio) bool

func Bool

func Bool(v bool) *bool

func CheckResponseError

func CheckResponseError(res *http.Response) (bool, error)

func ECLs

func ECLs(ecls []ECL) *[]ECL

func Float

func Float(v float64) *float64

func Int

func Int(v int) *int

func ParseCustomFields

func ParseCustomFields(cfraw map[string]interface{}, cfs []*CustomField) (map[string]interface{}, error)

func String

func String(v string) *string

func Strings

func Strings(v []string) *[]string

Types

type ACL

type ACL struct {
	Role
	On       string   `json:"on,omitempty"`
	AccessOn AccessOn `json:"onType"`
}

func (ACL) Hash

func (a ACL) Hash() string

func (ACL) String

func (a ACL) String() string

type AccessOn

type AccessOn string

type BackoffPolicy

type BackoffPolicy struct {
	Millis []int
}

BackoffPolicy implements a backoff policy, randomizing its delays and saturating at the final value in Millis.

func (BackoffPolicy) Duration

func (b BackoffPolicy) Duration(n int) time.Duration

Duration returns the time duration of the n'th wait cycle in a backoff policy. This is b.Millis[n], randomized to avoid thundering herds.

type Bio

type Bio struct {
	ECLItem
	Title          string    `json:"title,omitempty"`
	Photo          *EclPhoto `json:"photo,omitempty"`
	PhoneNumber    string    `json:"phone,omitempty"`
	EmailAddress   string    `json:"email,omitempty"`
	Education      []string  `json:"education"`
	Certifications []string  `json:"certifications"`
	Services       []string  `json:"services,omitempty"`
	Url            string    `json:"url,omitempty"`
}

type BiosECL

type BiosECL struct {
	ECL
	Sections []*BiosECLSection `json:"sections,omitempty"`
}

type BiosECLSection

type BiosECLSection struct {
	ECLSection
	Items []*Bio `json:"items,omitempty"` // max 100 items
}

type Category

type Category struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	FullName   string `json:"fullName"`
	Selectable bool   `json:"selectable"`
	ParentId   string `json:"parentId"`
}

Category is a representation of a Category in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Info_API/Categories.htm

type CategoryService

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

func (*CategoryService) List

func (s *CategoryService) List() ([]*Category, error)

type Client

type Client struct {
	Config *Config

	LocationService    *LocationService
	ECLService         *ECLService
	CustomFieldService *CustomFieldService
	FolderService      *FolderService
	CategoryService    *CategoryService
	LicenseService     *LicenseService
	UserService        *UserService
}

func NewClient

func NewClient(config *Config) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

func (*Client) DoRawRequest

func (c *Client) DoRawRequest(method string, path string, v interface{}) error

func (*Client) DoRawRequestJSON

func (c *Client) DoRawRequestJSON(method string, path string, obj interface{}, v interface{}) error

func (*Client) DoRequest

func (c *Client) DoRequest(method string, path string, v interface{}) error

func (*Client) DoRequestJSON

func (c *Client) DoRequestJSON(method string, path string, obj interface{}, v interface{}) error

func (*Client) NewCustomerRequestBody

func (c *Client) NewCustomerRequestBody(method string, path string, data []byte) (*http.Request, error)

func (*Client) NewRawRequest

func (c *Client) NewRawRequest(method string, path string) (*http.Request, error)

func (*Client) NewRawRequestBody

func (c *Client) NewRawRequestBody(method string, path string, data []byte) (*http.Request, error)

func (*Client) NewRawRequestJSON

func (c *Client) NewRawRequestJSON(method string, path string, obj interface{}) (*http.Request, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string) (*http.Request, error)

func (*Client) NewRequestBody

func (c *Client) NewRequestBody(method string, fullPath string, data []byte) (*http.Request, error)

func (*Client) NewRequestJSON

func (c *Client) NewRequestJSON(method string, path string, obj interface{}) (*http.Request, error)

type Comparable

type Comparable interface {
	Equal(Comparable) bool
}

type Config

type Config struct {
	HTTPClient *http.Client
	BaseUrl    string

	Username   string
	Password   string
	CustomerId string

	RetryCount *int

	Logger Logger
}

func NewConfig

func NewConfig() *Config

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) WithBaseUrl

func (c *Config) WithBaseUrl(baseUrl string) *Config

func (*Config) WithCredentials

func (c *Config) WithCredentials(username, password, customerid string) *Config

func (*Config) WithEnvCredentials

func (c *Config) WithEnvCredentials() *Config

func (*Config) WithHTTPClient

func (c *Config) WithHTTPClient(client *http.Client) *Config

func (*Config) WithHost

func (c *Config) WithHost(host string) *Config

func (*Config) WithLogger

func (c *Config) WithLogger(l Logger) *Config

func (*Config) WithProductionHost

func (c *Config) WithProductionHost() *Config

func (*Config) WithRetries

func (c *Config) WithRetries(r int) *Config

func (*Config) WithSandboxHost

func (c *Config) WithSandboxHost() *Config

func (*Config) WithStdLogger

func (c *Config) WithStdLogger() *Config

type Cost

type Cost struct {
	Type    string         `json:"type,omitempty"`
	Price   string         `json:"price,omitempty"`
	Unit    string         `json:"unit,omitempty"`
	RangeTo string         `json:"rangeTo,omitempty"`
	Other   string         `json:"other,omitempty"`
	Options []*CostOptions `json:"options,omitempty"`
}

type CostOptions

type CostOptions struct {
	Name    string `json:"name,omitempty"`
	Price   string `json:"price,omitempty"`
	Calorie int    `json:"calorie,omitempty"`
}

type CustomField

type CustomField struct {
	Name    string            `json:"name"`
	Id      string            `json:"id"`
	Options map[string]string `json:"options"` // Only present for multi-option custom fields
	Type    string            `json:"type"`
}

CustomField is the representation of a Custom Field definition in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Administration_API/Custom_Fields.htm

func (CustomField) String

func (c CustomField) String() string

type CustomFieldManager

type CustomFieldManager struct {
	CustomFields []*CustomField
}

func (*CustomFieldManager) CustomField

func (c *CustomFieldManager) CustomField(name string) (*CustomField, error)

func (*CustomFieldManager) CustomFieldId

func (c *CustomFieldManager) CustomFieldId(name string) (string, error)

func (*CustomFieldManager) CustomFieldOptionId

func (c *CustomFieldManager) CustomFieldOptionId(fieldName, optionName string) (string, error)

func (*CustomFieldManager) Get

func (c *CustomFieldManager) Get(name string, loc *Location) (interface{}, error)

func (*CustomFieldManager) IsOptionSet

func (c *CustomFieldManager) IsOptionSet(fieldName string, optionName string, loc *Location) (bool, error)

func (*CustomFieldManager) MustCustomField

func (c *CustomFieldManager) MustCustomField(name string) *CustomField

func (*CustomFieldManager) MustCustomFieldId

func (c *CustomFieldManager) MustCustomFieldId(name string) string

func (*CustomFieldManager) MustCustomFieldOptionId

func (c *CustomFieldManager) MustCustomFieldOptionId(fieldName, optionName string) string

func (*CustomFieldManager) MustGet

func (c *CustomFieldManager) MustGet(name string, loc *Location) interface{}

func (*CustomFieldManager) MustIsOptionSet

func (c *CustomFieldManager) MustIsOptionSet(fieldName string, optionName string, loc *Location) bool

func (*CustomFieldManager) MustSet

func (c *CustomFieldManager) MustSet(name string, value CustomFieldValue, loc *Location) *Location

func (*CustomFieldManager) MustSetOption

func (c *CustomFieldManager) MustSetOption(fieldName string, optionName string, loc *Location) *Location

func (*CustomFieldManager) MustUnsetOption

func (c *CustomFieldManager) MustUnsetOption(fieldName string, optionName string, loc *Location) *Location

func (*CustomFieldManager) Set

func (c *CustomFieldManager) Set(name string, value CustomFieldValue, loc *Location) (*Location, error)

func (*CustomFieldManager) SetOption

func (c *CustomFieldManager) SetOption(fieldName string, optionName string, loc *Location) (*Location, error)

func (*CustomFieldManager) UnsetOption

func (c *CustomFieldManager) UnsetOption(fieldName string, optionName string, loc *Location) (*Location, error)

type CustomFieldService

type CustomFieldService struct {
	CustomFieldManager *CustomFieldManager
	// contains filtered or unexported fields
}

func (*CustomFieldService) CacheCustomFields

func (s *CustomFieldService) CacheCustomFields() error

func (*CustomFieldService) List

func (s *CustomFieldService) List() ([]*CustomField, error)

func (*CustomFieldService) MustCacheCustomFields

func (s *CustomFieldService) MustCacheCustomFields()

type CustomFieldType

type CustomFieldType string

type CustomFieldValue

type CustomFieldValue interface {
	CustomFieldTag() string
}

type Date

type Date string

func (Date) CustomFieldTag

func (d Date) CustomFieldTag() string

type ECL

type ECL struct {
	Id       *string       `json:"id"`
	Name     *string       `json:"name,omitempty"`  // max length 100
	Title    *string       `json:"title,omitempty"` // max length 100
	Type     *string       `json:"type,omitempty"`  // one of MENU, BIOS, PRODUCTS, EVENTS
	Size     *int          `json:"size,omitempty"`  // read only
	Publish  *bool         `json:"publish"`
	Currency *string       `json:"currency,omitempty"` // ISO Code for currency
	Sections []*ECLSection `json:"sections,omitempty"`
}

func (ECL) GetCurrency

func (e ECL) GetCurrency() string

func (ECL) GetId

func (e ECL) GetId() string

func (ECL) GetName

func (e ECL) GetName() string

func (ECL) GetPublish

func (e ECL) GetPublish() bool

func (ECL) GetSize

func (e ECL) GetSize() int

func (ECL) GetTitle

func (e ECL) GetTitle() string

func (ECL) GetType

func (e ECL) GetType() string

type ECLItem

type ECLItem struct {
	Id          *string `json:"id"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

func (ECLItem) GetDescription

func (e ECLItem) GetDescription() string

func (ECLItem) GetId

func (e ECLItem) GetId() string

func (ECLItem) GetName

func (e ECLItem) GetName() string

type ECLSection

type ECLSection struct {
	Id          *string `json:"id"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

func (ECLSection) GetDescription

func (e ECLSection) GetDescription() string

func (ECLSection) GetId

func (e ECLSection) GetId() string

func (ECLSection) GetName

func (e ECLSection) GetName() string

type ECLService

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

func (*ECLService) Create

func (e *ECLService) Create(y *ECL) (*ECL, error)

func (*ECLService) CreateBioList

func (e *ECLService) CreateBioList(y *BiosECL) (*BiosECL, error)

func (*ECLService) CreateEventList

func (e *ECLService) CreateEventList(y *EventsECL) (*EventsECL, error)

func (*ECLService) CreateProductList

func (e *ECLService) CreateProductList(y *ProductsECL) (*ProductsECL, error)

func (*ECLService) Edit

func (e *ECLService) Edit(y *ECL) (*ECL, error)

func (*ECLService) EditBioList

func (e *ECLService) EditBioList(y *BiosECL) (*BiosECL, error)

func (*ECLService) EditEventList

func (e *ECLService) EditEventList(y *EventsECL) (*EventsECL, error)

func (*ECLService) EditProductList

func (e *ECLService) EditProductList(y *ProductsECL) (*ProductsECL, error)

func (*ECLService) GetBioList

func (e *ECLService) GetBioList(id string) (*BiosECL, error)

func (*ECLService) GetEventList

func (e *ECLService) GetEventList(id string) (*EventsECL, error)

func (*ECLService) GetList

func (e *ECLService) GetList(id string) (*ECL, error)

func (*ECLService) GetProductList

func (e *ECLService) GetProductList(id string) (*ProductsECL, error)

func (*ECLService) List

func (e *ECLService) List() (*ListECLResponse, error)

type EclPhoto

type EclPhoto struct {
	Url    string `json:"url"`
	Height int    `json:"height,omitempty"`
	Width  int    `json:"width,omitempty"`
}

type Error

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"errorCode"`
}

func (*Error) Error

func (e *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Errors   []Error `json:"errors"`
	Response *http.Response
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Event

type Event struct {
	ECLItem
	Type   string      `json:"type,omitempty"`
	Starts string      `json:"starts,omitempty"`
	Ends   string      `json:"ends,omitempty"`
	Photos []*EclPhoto `json:"photos,omitempty"`
	Url    string      `json:"url,omitempty"`
}

type EventsECL

type EventsECL struct {
	ECL
	Sections []*EventsECLSection `json:"sections,omitempty"`
}

type EventsECLSection

type EventsECLSection struct {
	ECLSection
	Items []*Event `json:"items,omitempty"` // max 100 items
}

type Folder

type Folder struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	ParentId string `json:"parentId"`
}

Folder is a representation of a Folder in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Administration_API/Folders.htm

type FolderService

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

func (*FolderService) List

func (s *FolderService) List() ([]*Folder, error)
type Gallery []*Photo

func (*Gallery) CustomFieldTag

func (g *Gallery) CustomFieldTag() string

type HolidayHours

type HolidayHours struct {
	Date  string `json:"date"`
	Hours string `json:"hours"`
}

HolidayHours represents individual exceptions to a Location's regular hours in Yext Location Manager. For details see

type Hours

type Hours struct {
	AdditionalText string         `json:"additionalHoursText,omitempty"`
	Hours          string         `json:"hours,omitempty"`
	HolidayHours   []HolidayHours `json:"holidayHours,omitempty"`
}

func (*Hours) CustomFieldTag

func (h *Hours) CustomFieldTag() string

type LicensePack

type LicensePack struct {
	LocationIds []string `json:"locationIds,omitempty"`
	Features    []string `json:"features,omitempty"`
	Id          int      `json:"id,omitempty"`
	Quantity    int      `json:"quantity,omitempty"`
	Status      string   `json:"status,omitempty"`
}

type LicenseService

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

func (*LicenseService) AddLocationToLicense

func (l *LicenseService) AddLocationToLicense(licenseId string, locationId string) (*LicensePack, error)

func (*LicenseService) AddLocationsToLicenseBulk

func (l *LicenseService) AddLocationsToLicenseBulk(licenseId string, locationIds []string) (*LicensePack, error)

func (*LicenseService) Get

func (l *LicenseService) Get(id string) (*LicensePack, error)

func (*LicenseService) RemoveLocationFromLicense

func (l *LicenseService) RemoveLocationFromLicense(licenseId string, locationId string) (*LicensePack, error)

func (*LicenseService) RemoveLocationsFromLicenseBulk

func (l *LicenseService) RemoveLocationsFromLicenseBulk(licenseId string, locationIds []string) (*LicensePack, error)

type ListECLResponse

type ListECLResponse struct {
	AllLists     []*ECL
	ProductLists []*ProductsECL
	BioLists     []*BiosECL
	EventsLists  []*EventsECL
}

ListECLResponse is a calculated value that provides typed access to an underlying 'ListECL' response

type Location

type Location struct {
	Id                     *string                `json:"id,omitempty"`
	Name                   *string                `json:"locationName,omitempty"`
	LocationType           *string                `json:"locationType,omitempty"`
	FirstName              *string                `json:"firstName,omitempty"`
	MiddleName             *string                `json:"middleName,omitempty"`
	LastName               *string                `json:"lastName,omitempty"`
	NPI                    *string                `json:"npi,omitempty"`
	Lists                  *[]ECL                 `json:"lists,omitempty"`
	Keywords               *[]string              `json:"keywords,omitempty"`
	Associations           *[]string              `json:"associations,omitempty"`
	CustomFields           map[string]interface{} `json:"customFields,omitempty"`
	CustomerId             *string                `json:"customerId,omitempty"`
	Address                *string                `json:"address,omitempty"`
	Address2               *string                `json:"address2,omitempty"`
	SuppressAddress        *bool                  `json:"suppressAddress,omitempty"`
	DisplayAddress         *string                `json:"displayAddress,omitempty"`
	City                   *string                `json:"city,omitempty"`
	State                  *string                `json:"state,omitempty"`
	Zip                    *string                `json:"zip,omitempty"`
	CountryCode            *string                `json:"countryCode,omitempty"`
	Phone                  *string                `json:"phone,omitempty"`
	IsPhoneTracked         *bool                  `json:"isPhoneTracked,omitempty"`
	LocalPhone             *string                `json:"localPhone,omitempty"`
	AlternatePhone         *string                `json:"alternatePhone,omitempty"`
	FaxPhone               *string                `json:"faxPhone,omitempty"`
	MobilePhone            *string                `json:"mobilePhone,omitempty"`
	TollFreePhone          *string                `json:"tollFreePhone,omitempty"`
	TtyPhone               *string                `json:"ttyPhone,omitempty"`
	SpecialOffer           *string                `json:"specialOffer,omitempty"`
	SpecialOfferUrl        *string                `json:"specialOfferUrl,omitempty"`
	WebsiteUrl             *string                `json:"websiteUrl,omitempty"`
	DisplayWebsiteUrl      *string                `json:"displayWebsiteUrl,omitempty"`
	ReservationUrl         *string                `json:"reservationUrl,omitempty"`
	Hours                  *string                `json:"hours,omitempty"` // A concrete type would be nice for this
	AdditionalHoursText    *string                `json:"additionalHoursText,omitempty"`
	Description            *string                `json:"description,omitempty"`
	PaymentOptions         *[]string              `json:"paymentOptions,omitempty"`
	VideoUrls              *[]string              `json:"videoUrls,omitempty"`
	TwitterHandle          *string                `json:"twitterHandle,omitempty"`
	FacebookPageUrl        *string                `json:"facebookPageUrl,omitempty"`
	YearEstablished        *string                `json:"yearEstablished,omitempty"`
	DisplayLat             *float64               `json:"displayLat,omitempty"`
	DisplayLng             *float64               `json:"displayLng,omitempty"`
	RoutableLat            *float64               `json:"routableLat,omitempty"`
	RoutableLng            *float64               `json:"routableLng,omitempty"`
	Emails                 *[]string              `json:"emails,omitempty"`
	Specialties            *[]string              `json:"specialties,omitempty"`
	Services               *[]string              `json:"services,omitempty"`
	Brands                 *[]string              `json:"brands,omitempty"`
	Languages              *[]string              `json:"languages,omitempty"`
	FolderId               *string                `json:"folderId,omitempty"`
	LabelIds               *UnorderedStrings      `json:"labelIds,omitempty"`
	FacebookCoverPhoto     *LocationPhoto         `json:"facebookCoverPhoto,omitempty"`
	FacebookProfilePicture *LocationPhoto         `json:"facebookProfilePicture,omitempty"`
	Photos                 []LocationPhoto        `json:"photos,omitempty"`
	Closed                 *LocationClosed        `json:"closed,omitempty"`
	CategoryIds            *[]string              `json:"categoryIds,omitempty"`
	HolidayHours           []HolidayHours         `json:"holidayHours,omitempty"`
	AdmittingHospitals     *[]string              `json:"admittingHospitals,omitempty"`
	// contains filtered or unexported fields
}

Location is the representation of a Location in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Administration_API/Locations.htm

func (Location) Diff

func (y Location) Diff(b *Location) (d *Location, diff bool)

Diff calculates the differences between a base Location (a) and a proposed set of changes represented by a second Location (b). The diffing logic will ignore fields in the proposed Location that aren't set (nil). This characteristic makes the function ideal for calculting the minimal PUT required to bring an object "up-to-date" via the API.

Example:

var (
  // Typically, this would come from an authoritative source, like the API
  base     = Location{Name: "Yext, Inc.", Address1: "123 Mulberry St"}
  proposed = Location{Name: "Yext, Inc.", Address1: "456 Washington St"}
)

delta, isDiff := base.Diff(proposed)
// isDiff -> true
// delta -> &Location{Address1: "456 Washington St"}

delta, isDiff = base.Diff(base)
// isDiff -> false
// delta -> nil

func (Location) GetAdditionalHoursText

func (y Location) GetAdditionalHoursText() string

func (Location) GetAddress

func (y Location) GetAddress() string

func (Location) GetAddress2

func (y Location) GetAddress2() string

func (Location) GetAdmittingHospitals

func (y Location) GetAdmittingHospitals() (v []string)

func (Location) GetAlternatePhone

func (y Location) GetAlternatePhone() string

func (Location) GetAssociations

func (y Location) GetAssociations() (v []string)

func (Location) GetBrands

func (y Location) GetBrands() (v []string)

func (Location) GetCategoryIds

func (y Location) GetCategoryIds() (v []string)

func (Location) GetCity

func (y Location) GetCity() string

func (Location) GetCountryCode

func (y Location) GetCountryCode() string

func (Location) GetCustomerId

func (y Location) GetCustomerId() string

func (Location) GetDescription

func (y Location) GetDescription() string

func (Location) GetDisplayAddress

func (y Location) GetDisplayAddress() string

func (Location) GetDisplayLat

func (y Location) GetDisplayLat() float64

func (Location) GetDisplayLng

func (y Location) GetDisplayLng() float64

func (Location) GetDisplayWebsiteUrl

func (y Location) GetDisplayWebsiteUrl() string

func (Location) GetEmails

func (y Location) GetEmails() (v []string)

func (Location) GetFacebookPageUrl

func (y Location) GetFacebookPageUrl() string

func (Location) GetFaxPhone

func (y Location) GetFaxPhone() string

func (Location) GetFirstName

func (y Location) GetFirstName() string

func (Location) GetFolderId

func (y Location) GetFolderId() string

func (Location) GetHours

func (y Location) GetHours() string

func (Location) GetId

func (y Location) GetId() string

func (Location) GetIsPhoneTracked

func (y Location) GetIsPhoneTracked() bool

func (Location) GetKeywords

func (y Location) GetKeywords() (v []string)

func (Location) GetLabelIds

func (y Location) GetLabelIds() (v UnorderedStrings)

func (Location) GetLanguages

func (y Location) GetLanguages() (v []string)

func (Location) GetLastName

func (y Location) GetLastName() string

func (Location) GetLists

func (y Location) GetLists() (v []ECL)

func (Location) GetLocalPhone

func (y Location) GetLocalPhone() string

func (Location) GetLocationType

func (y Location) GetLocationType() string

func (Location) GetMiddleName

func (y Location) GetMiddleName() string

func (Location) GetMobilePhone

func (y Location) GetMobilePhone() string

func (Location) GetNPI

func (y Location) GetNPI() string

func (Location) GetName

func (y Location) GetName() string

func (Location) GetPaymentOptions

func (y Location) GetPaymentOptions() (v []string)

func (Location) GetPhone

func (y Location) GetPhone() string

func (Location) GetReservationUrl

func (y Location) GetReservationUrl() string

func (Location) GetRoutableLat

func (y Location) GetRoutableLat() float64

func (Location) GetRoutableLng

func (y Location) GetRoutableLng() float64

func (Location) GetServices

func (y Location) GetServices() (v []string)

func (Location) GetSpecialOffer

func (y Location) GetSpecialOffer() string

func (Location) GetSpecialOfferUrl

func (y Location) GetSpecialOfferUrl() string

func (Location) GetSpecialties

func (y Location) GetSpecialties() (v []string)

func (Location) GetState

func (y Location) GetState() string

func (Location) GetSuppressAddress

func (y Location) GetSuppressAddress() bool

func (Location) GetTollFreePhone

func (y Location) GetTollFreePhone() string

func (Location) GetTtyPhone

func (y Location) GetTtyPhone() string

func (Location) GetTwitterHandle

func (y Location) GetTwitterHandle() string

func (Location) GetVideoUrls

func (y Location) GetVideoUrls() (v []string)

func (Location) GetWebsiteUrl

func (y Location) GetWebsiteUrl() string

func (Location) GetYearEstablished

func (y Location) GetYearEstablished() string

func (Location) GetZip

func (y Location) GetZip() string

func (Location) SetLabelIds

func (y Location) SetLabelIds(v []string)

func (Location) SetLabelIdsWithUnorderedStrings

func (y Location) SetLabelIdsWithUnorderedStrings(v UnorderedStrings)

func (Location) String

func (y Location) String() string

type LocationClosed

type LocationClosed struct {
	IsClosed   string `json:"isClosed"`
	ClosedDate string `json:"closedDate,omitempty"`
}

LocationClosed represents the 'closed' state of a Location in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Administration_API/Locations.htm#Closed

func (LocationClosed) String

func (l LocationClosed) String() string

type LocationPhoto

type LocationPhoto struct {
	Url             string `json:"url,omitempty"`
	Description     string `json:"description,omitempty"`
	ClickThroughURL string `json:"clickthroughUrl,omitempty"`
}

Photo represents a photo associated with a Location in Yext Location Manager. For details see https://www.yext.com/support/platform-api/#Administration_API/Locations.htm#Photo

type LocationService

type LocationService struct {
	CustomFields []*CustomField
	// contains filtered or unexported fields
}

func (*LocationService) Create

func (l *LocationService) Create(y *Location) (*Location, error)

func (*LocationService) Edit

func (l *LocationService) Edit(y *Location) (*Location, error)

func (*LocationService) Get

func (l *LocationService) Get(id string) (*Location, error)

func (*LocationService) HydrateLocation

func (l *LocationService) HydrateLocation(loc *Location) (*Location, error)

func (*LocationService) HydrateLocations

func (l *LocationService) HydrateLocations(locs []*Location) ([]*Location, error)

func (*LocationService) List

func (l *LocationService) List() ([]*Location, error)

func (*LocationService) ListBySearchIds

func (l *LocationService) ListBySearchIds(searchIds []string) ([]*Location, error)

type Logger

type Logger interface {
	Log(...interface{})
}

func NewStdLogger

func NewStdLogger() Logger

type MultiLineText

type MultiLineText string

func (MultiLineText) CustomFieldTag

func (m MultiLineText) CustomFieldTag() string

type MultiOption

type MultiOption UnorderedStrings

func (MultiOption) CustomFieldTag

func (m MultiOption) CustomFieldTag() string

func (MultiOption) Equal

func (m MultiOption) Equal(c Comparable) bool

func (*MultiOption) IsOptionIdSet

func (m *MultiOption) IsOptionIdSet(id string) bool

func (*MultiOption) SetOptionId

func (m *MultiOption) SetOptionId(id string)

func (*MultiOption) UnsetOptionId

func (m *MultiOption) UnsetOptionId(id string)

type Number

type Number string

func (Number) CustomFieldTag

func (n Number) CustomFieldTag() string

type OptionField

type OptionField interface {
	CustomFieldValue
	SetOptionId(id string)
	UnsetOptionId(id string)
	IsOptionIdSet(id string) bool
}

type Photo

type Photo struct {
	Url             string `json:"url,omitempty"`
	Description     string `json:"description,omitempty"`
	Details         string `json:"details,omitempty"`
	ClickThroughURL string `json:"clickthroughUrl,omitempty"`
}

func (*Photo) CustomFieldTag

func (p *Photo) CustomFieldTag() string

func (Photo) String

func (l Photo) String() string

type Product

type Product struct {
	ECLItem
	Type   string      `json:"idcode,omitempty"`
	Cost   *Cost       `json:"cost,omitempty"`
	Photos []*EclPhoto `json:"photos,omitempty"`
	Video  string      `json:"video,omitempty"`
	Url    string      `json:"url,omitempty"`
}

type ProductsECL

type ProductsECL struct {
	ECL
	Sections []*ProductsECLSection `json:"sections,omitempty"`
}

type ProductsECLSection

type ProductsECLSection struct {
	ECLSection
	Items []*Product `json:"items,omitempty"` // max 100 items
}

type Role

type Role struct {
	Id   int     `json:"roleId,omitempty"`
	Name *string `json:"roleName,omitempty"`
}

func (*Role) GetName

func (r *Role) GetName() string

func (*Role) String

func (r *Role) String() string

type SingleLineText

type SingleLineText string

func (SingleLineText) CustomFieldTag

func (s SingleLineText) CustomFieldTag() string

type SingleOption

type SingleOption string

func (SingleOption) CustomFieldTag

func (s SingleOption) CustomFieldTag() string

func (*SingleOption) IsOptionIdSet

func (s *SingleOption) IsOptionIdSet(id string) bool

func (*SingleOption) SetOptionId

func (s *SingleOption) SetOptionId(id string)

func (*SingleOption) UnsetOptionId

func (s *SingleOption) UnsetOptionId(id string)

type TextList

type TextList []string

func (TextList) CustomFieldTag

func (t TextList) CustomFieldTag() string

type UnorderedStrings

type UnorderedStrings []string

UnorderedStrings masks []string properties for which Order doesn't matter, such as LabelIds

func ToUnorderedStrings

func ToUnorderedStrings(v []string) *UnorderedStrings

func (*UnorderedStrings) Equal

func (a *UnorderedStrings) Equal(b Comparable) bool

Equal compares UnorderedStrings

type Url

type Url string

func (Url) CustomFieldTag

func (u Url) CustomFieldTag() string

type User

type User struct {
	Id           *string `json:"id,omitempty"`        // req in post
	FirstName    *string `json:"firstName,omitempty"` // req in post
	LastName     *string `json:"lastName,omitempty"`  // req in post
	UserName     *string `json:"username,omitempty"`
	EmailAddress *string `json:"emailAddress,omitempty"` // req in post
	PhoneNumber  *string `json:"phoneNumber,omitempty"`
	Password     *string `json:"password,omitempty"`
	SSO          *bool   `json:"sso,omitempty"`
	ACLs         []ACL   `json:"acl,omitempty"`
}

func (*User) Copy

func (u *User) Copy() (n *User)

func (*User) Diff

func (a *User) Diff(b *User) (d *User, diff bool)

Diff calculates the differences betwee a base User (a) and a proposed set of changes represented by a second User (b). The diffing logic will ignore fields in (b) location that aren't set (nil). This characteristic makes the function ideal for calculating the minimal PUT required to up date an object via the API.

func (*User) GetEmailAddress

func (u *User) GetEmailAddress() string

func (*User) GetFirstName

func (u *User) GetFirstName() string

func (*User) GetId

func (u *User) GetId() string

func (*User) GetLastName

func (u *User) GetLastName() string

func (*User) GetPassword

func (u *User) GetPassword() string

func (*User) GetPhoneNumber

func (u *User) GetPhoneNumber() string

func (*User) GetSSO

func (u *User) GetSSO() bool

func (*User) GetUserName

func (u *User) GetUserName() string

func (*User) String

func (u *User) String() string

type UserService

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

func (*UserService) AvailableRoles

func (u *UserService) AvailableRoles() ([]*Role, error)

func (*UserService) Create

func (u *UserService) Create(y *User) (*User, error)

func (*UserService) Delete

func (u *UserService) Delete(y *User) error

func (*UserService) Edit

func (u *UserService) Edit(y *User) (*User, error)

func (*UserService) Get

func (u *UserService) Get(id string) (*User, error)

func (*UserService) List

func (u *UserService) List(start, limit int) ([]*User, error)

func (*UserService) ListAll

func (u *UserService) ListAll() ([]*User, error)

func (*UserService) NewCustomerACL

func (u *UserService) NewCustomerACL(r Role) ACL

func (*UserService) NewFolderACL

func (u *UserService) NewFolderACL(f *Folder, r Role) ACL

func (*UserService) NewLocationACL

func (u *UserService) NewLocationACL(l *Location, r Role) ACL

type Video

type Video struct {
	Description string `json:"description"`
	Url         string `json:"url"`
}

type VideoGallery

type VideoGallery []Video

func (*VideoGallery) CustomFieldTag

func (v *VideoGallery) CustomFieldTag() string

type YesNo

type YesNo bool

func (YesNo) CustomFieldTag

func (y YesNo) CustomFieldTag() string

Jump to

Keyboard shortcuts

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