Documentation ¶
Overview ¶
Package planhat provides a client for using the Planhat API.
Usage:
import "github.com/darrenparkinson/planhat"
Construct a new Planhat client, then use the various services on the client to access different parts of the Planhat API. For example:
client := planhat.NewClient(apikey, cluster, nil) // List companies companies, err := ph.CompanyService.List(ctx)
Some API methods have optional parameters that can be passed. For example:
ph, _ := planhat.NewClient(apikey, cluster, nil) opts := &planhat.CompanyListOptions{Limit: planhat.Int(10), Offset: planhat.Int(0)} companies, err := ph.CompanyService.List(ctx, opts)
The services of a client divide the API into logical areas and correspond to the structure of the Planhat API documentation at https://docs.planhat.com/
NOTE: Using the context package, one can easily pass cancelation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.
Authentication ¶
Authentication is provided by an API Key as outlined in the documentation at https://docs.planhat.com/#authentication. You are able to provide the API Key as part of initialisation using `NewClient`.
You can obtain an API key by navigating to "Service Accounts" and adding a new service account user that has the permissions you require, followed by clicking the "Generate New Token" button.
If you receive a `planhat: unauthorized request` message, you may be using an incorrect region.
Region ¶
Planhat supports various regions and cluster as outlined in the documentation at https://docs.planhat.com/#base-url). You must provide the cluster you are using to `NewClient` on initialisation. Ask your planhat representative or [check the docs](https://docs.planhat.com/#introduction) to see which one you need to use. If there is no specified cluster, you may pass an empty string.
Examples:
* "" becomes `api`, * `eu` becomes `api-eu`, * `eu2` becomes `api-eu2`, * `eu3` becomes `api-eu3`, * `us2` becomes `api-us2`
Pagination ¶
Where pagination is provided, Planhat provides the Offset and Limit query parameters as part of the request parameters for a given endpoint. These can be passed via options to the command:
companies, err := c.CompanyService.List(ctx, &planhat.CompanyListOptions{Limit: planhat.Int(10), Offset: planhat.Int(0)})
By way of an example, you might use the following to work through multiple pages:
var allCompanies []*planhat.Company limit, offset := 10, 0 for { companies, _ := ph.CompanyService.List(ctx, &planhat.CompanyListOptions{Limit: planhat.Int(limit), Offset: planhat.Int(offset)}) log.Println("Retrieved", len(companies), "companies") offset += limit if len(companies) == 0 { break } allCompanies = append(allCompanies, companies...) } log.Println("Found total", len(allCompanies), "companies.")
As you can see, planhat doesn't provide a mechanism to check if there are more values, so we keep going until there are no results.
Sorting ¶
Where sorting is provided, Planhat provides the Sort query parameter as part of the request parameters for a given endpoint. This can also be passed via the options to the command and is used in conjuntion with pagination:
companies, err := c.CompanyService.List(ctx, &planhat.CompanyListOptions{Limit: planhat.Int(10), Offset: planhat.Int(0), Sort: planhat.String("name")})
Note that the sort string appears to be case sensitive and must currently use the Planhat object name.
Copyright 2021 The go-planhat AUTHORS. All rights reserved.
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. Code generated by gen-accessors; DO NOT EDIT.
Index ¶
- Constants
- func Bool(v bool) *bool
- func Float64(v float64) *float64
- func Int(v int) *int
- func Int64(v int64) *int64
- func String(v string) *string
- type Asset
- type AssetListOptions
- type AssetService
- func (s *AssetService) BulkUpsert(ctx context.Context, assets []Asset) (*UpsertResponse, error)
- func (s *AssetService) Create(ctx context.Context, asset Asset) (*Asset, error)
- func (s *AssetService) Delete(ctx context.Context, id string) (*DeleteResponse, error)
- func (s *AssetService) Get(ctx context.Context, id string) (*Asset, error)
- func (s *AssetService) GetByExternalID(ctx context.Context, externalID string) (*Asset, error)
- func (s *AssetService) GetBySourceID(ctx context.Context, sourceID string) (*Asset, error)
- func (s *AssetService) List(ctx context.Context, options ...*AssetListOptions) ([]*Asset, error)
- func (s *AssetService) Update(ctx context.Context, id string, asset Asset) (*Asset, error)
- type Client
- type Company
- func (c *Company) GetCSMScore() int
- func (c *Company) GetCustomerFrom() time.Time
- func (c *Company) GetCustomerTo() time.Time
- func (c *Company) GetExternalID() string
- func (c *Company) GetH() int
- func (c *Company) GetID() string
- func (c *Company) GetLastRenewal() time.Time
- func (c *Company) GetLicenses() []License
- func (c *Company) GetMR() *float64
- func (c *Company) GetMRR() *float64
- func (c *Company) GetMRRTotal() *float64
- func (c *Company) GetMRTotal() *float64
- func (c *Company) GetNRR30() int
- func (c *Company) GetNRRTotal() int
- func (c *Company) GetName() string
- func (c *Company) GetPhase() string
- func (c *Company) GetPhaseSince() time.Time
- func (c *Company) GetProducts() []string
- func (c *Company) GetRenewalDate() time.Time
- func (c *Company) GetRenewalDaysFromNow() int
- func (c *Company) GetStatus() string
- type CompanyListOptions
- type CompanyService
- func (s *CompanyService) BulkUpsert(ctx context.Context, companies []Company) (*UpsertResponse, error)
- func (s *CompanyService) Create(ctx context.Context, company Company) (*Company, error)
- func (s *CompanyService) Delete(ctx context.Context, id string) (*DeleteResponse, error)
- func (s *CompanyService) Get(ctx context.Context, id string) (*Company, error)
- func (s *CompanyService) GetByExternalID(ctx context.Context, externalID string) (*Company, error)
- func (s *CompanyService) GetBySourceID(ctx context.Context, sourceID string) (*Company, error)
- func (s *CompanyService) LeanList(ctx context.Context, options ...*LeanCompanyListOptions) ([]*LeanCompany, error)
- func (s *CompanyService) List(ctx context.Context, options ...*CompanyListOptions) ([]*Company, error)
- func (s *CompanyService) Update(ctx context.Context, id string, company Company) (*Company, error)
- type Custom
- type DeleteResponse
- type DimensionData
- type EndUserService
- type Err
- type LeanCompany
- type LeanCompanyListOptions
- type License
- type Metric
- type MetricsListOptions
- type MetricsService
- type UpsertMetricsResponse
- type UpsertResponse
- type User
- func (u *User) GetCompanyFilter() string
- func (u *User) GetCompressedView() bool
- func (u *User) GetCreateDate() time.Time
- func (u *User) GetDailyDigest() bool
- func (u *User) GetDefaultMeetingLength() int
- func (u *User) GetEmail() string
- func (u *User) GetFirstName() string
- func (u *User) GetFollowerUpdate() bool
- func (u *User) GetID() string
- func (u *User) GetInAppNotifications() bool
- func (u *User) GetInactive() bool
- func (u *User) GetIsExposedAsSenderOption() bool
- func (u *User) GetIsHidden() bool
- func (u *User) GetLastName() string
- func (u *User) GetNickName() string
- func (u *User) GetPlayLogDisabled() bool
- func (u *User) GetRadarOneLine() bool
- func (u *User) GetRecentOpenPage() string
- func (u *User) GetRemoved() bool
- func (u *User) GetRevReportPeriodType() string
- func (u *User) GetSegment() string
- func (u *User) GetSplitLayoutDisabled() bool
- func (u *User) GetTaskFilter() string
- func (u *User) GetV() int
- func (u *User) GetWorkflowFilter() string
- type UserService
Constants ¶
const ( ErrBadRequest = Err("planhat: bad request") ErrForbidden = Err("planhat: forbidden") ErrInternalError = Err("planhat: internal error") ErrUnknown = Err("planhat: unexpected error occurred") ErrMissingTenantUUID = Err("planhat: missing required tenant uuid for this request") )
Error Constants Cisco documents these as the only error responses they will emit.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func Float64 ¶
Float64 is a helper routine that allocates a new Float64 value to store v and returns a pointer to it.
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
Types ¶
type Asset ¶
type Asset struct { ID *string `json:"_id,omitempty"` Name *string `json:"name,omitempty"` CompanyID *string `json:"companyId,omitempty"` ExternalID *string `json:"externalId,omitempty"` SourceID *string `json:"sourceId,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` }
Asset represents a planhat asset.
func (*Asset) GetCompanyID ¶
GetCompanyID returns the CompanyID field if it's non-nil, zero value otherwise.
func (*Asset) GetExternalID ¶
GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (*Asset) GetSourceID ¶
GetSourceID returns the SourceID field if it's non-nil, zero value otherwise.
type AssetListOptions ¶
type AssetListOptions struct { // Limit the list length. Limit *int `url:"limit,omitempty"` // Start the list on a specific integer index. Offset *int `url:"offset,omitempty"` // Sort based on a specific property. Prefix the property "-" to change the sort order. Sort *string `url:"sort,omitempty"` // Select specific properties. This is case sensitive and currently needs to be the planhat names as // a comma separated string, e.g. "companyid,name". Select *string `url:"select,omitempty"` // Filter using company id. Multiple ids can be used separating them by commas. CompanyID *string `url:"companyId,omitempty"` }
AssetListOptions represents query parameters for listing assets. They are pointer values in order to distinguish between unset fields and those with set to a zero value. Use the helper function planhat.Int() or planhat.String() to set the values.
func (*AssetListOptions) GetLimit ¶
func (a *AssetListOptions) GetLimit() int
GetLimit returns the Limit field if it's non-nil, zero value otherwise.
func (*AssetListOptions) GetOffset ¶
func (a *AssetListOptions) GetOffset() int
GetOffset returns the Offset field if it's non-nil, zero value otherwise.
func (*AssetListOptions) GetSelect ¶
func (a *AssetListOptions) GetSelect() string
GetSelect returns the Select field if it's non-nil, zero value otherwise.
func (*AssetListOptions) GetSort ¶
func (a *AssetListOptions) GetSort() string
GetSort returns the Sort field if it's non-nil, zero value otherwise.
type AssetService ¶
type AssetService struct {
// contains filtered or unexported fields
}
AssetService represents the Assets group
func (*AssetService) BulkUpsert ¶
func (s *AssetService) BulkUpsert(ctx context.Context, assets []Asset) (*UpsertResponse, error)
BulkUpsert will update or insert assets. To create an asset it's required define a name and a valid companyId. To update an asset it is required to specify in the payload one of the following keyables:
_id, sourceId and/or externalId.
Since this is a bulk upsert operation it's possible create and/or update multiple assets with the same payload. Note there is an upper limit of 50,000 items per request. For more information, see the [planhat docs](https://docs.planhat.com/#bulk_upsert)
func (*AssetService) Delete ¶
func (s *AssetService) Delete(ctx context.Context, id string) (*DeleteResponse, error)
Delete is used delete an asset. It is required to pass the _id (ID).
func (*AssetService) Get ¶
Get returns a single asset given it's planhat ID Alternately it's possible to get an asset using its externalId and/or sourceId adding a prefix and passing one of these keyables as identifiers. e.g. extid-{{externalId}} or srcid-{{sourceId}}. Helper functions have also been provided for this.
func (*AssetService) GetByExternalID ¶
GetByExternalID retrieves an asset using it's external ID
func (*AssetService) GetBySourceID ¶
GetBySourceID retrieves an asset using it's source ID
func (*AssetService) List ¶
func (s *AssetService) List(ctx context.Context, options ...*AssetListOptions) ([]*Asset, error)
List will list assets based on the AssetListOptions provided
func (*AssetService) Update ¶
Update will update a planhat asset. To update an asset it is required to pass the asset _id in the request. Alternately it is possible to update using the asset externalId and/or sourceId adding a prefix and passing one of these keyables as identifiers. e.g. extid-{{externalId}} or srcid-{{sourceId}}
type Client ¶
type Client struct { // BaseURL for Planhat API. Set to https://api-eu3.planhat.com using `planhat.New()`, or set directly. BaseURL string // MetricsURL for Planhat API. Set to https://analytics.planhat.com/dimensiondata as per the planhat docs. MetricsURL string //HTTP Client to use for making requests, allowing the user to supply their own if required. HTTPClient *http.Client //API Key for Planhat. APIKey string //TenantUUID for posting to the metrics endpoint. Only required if you're sending in metrics. TenantUUID string MetricsService *MetricsService AssetService *AssetService CompanyService *CompanyService EndUserService *EndUserService UserService *UserService // contains filtered or unexported fields }
Client is the main planhat client for interacting with the library. It can be created using NewClient
type Company ¶
type Company struct { // CoOwner of the company. Empty interface due to GetCompany returning an ID string and GetCompanies returning an ID and Nickname CoOwner *interface{} `json:"coOwner,omitempty"` CSMScore *int `json:"csmScore,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` CustomerFrom *time.Time `json:"customerFrom,omitempty"` CustomerTo *time.Time `json:"customerTo,omitempty"` ExternalID *string `json:"externalId,omitempty"` H *int `json:"h,omitempty"` ID *string `json:"_id,omitempty"` LastRenewal *time.Time `json:"lastRenewal,omitempty"` LastTouch *interface{} `json:"lastTouch,omitempty"` LastTouchType *interface{} `json:"lastTouchType,omitempty"` Licenses *[]License `json:"licenses,omitempty"` MR *float64 `json:"mr,omitempty"` MRR *float64 `json:"mrr,omitempty"` MRRTotal *float64 `json:"mrrTotal,omitempty"` MRTotal *float64 `json:"mrTotal,omitempty"` Name *string `json:"name,omitempty"` NRR30 *int `json:"nrr30,omitempty"` NRRTotal *int `json:"nrrTotal,omitempty"` // Owner of the company. Empty interface due to GetCompany returning an ID string and GetCompanies returning an ID and Nickname Owner *interface{} `json:"owner,omitempty"` Phase *string `json:"phase,omitempty"` PhaseSince *time.Time `json:"phaseSince,omitempty"` Products *[]string `json:"products,omitempty"` RenewalDate *time.Time `json:"renewalDate,omitempty"` RenewalDaysFromNow *int `json:"renewalDaysFromNow,omitempty"` Status *string `json:"status,omitempty"` }
Company represents a planhat company.
func (*Company) GetCSMScore ¶
GetCSMScore returns the CSMScore field if it's non-nil, zero value otherwise.
func (*Company) GetCustomerFrom ¶
GetCustomerFrom returns the CustomerFrom field if it's non-nil, zero value otherwise.
func (*Company) GetCustomerTo ¶
GetCustomerTo returns the CustomerTo field if it's non-nil, zero value otherwise.
func (*Company) GetExternalID ¶
GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (*Company) GetLastRenewal ¶
GetLastRenewal returns the LastRenewal field if it's non-nil, zero value otherwise.
func (*Company) GetLicenses ¶
GetLicenses returns the Licenses field if it's non-nil, zero value otherwise.
func (*Company) GetMRRTotal ¶
GetMRRTotal returns the MRRTotal field.
func (*Company) GetMRTotal ¶
GetMRTotal returns the MRTotal field.
func (*Company) GetNRRTotal ¶
GetNRRTotal returns the NRRTotal field if it's non-nil, zero value otherwise.
func (*Company) GetPhaseSince ¶
GetPhaseSince returns the PhaseSince field if it's non-nil, zero value otherwise.
func (*Company) GetProducts ¶
GetProducts returns the Products field if it's non-nil, zero value otherwise.
func (*Company) GetRenewalDate ¶
GetRenewalDate returns the RenewalDate field if it's non-nil, zero value otherwise.
func (*Company) GetRenewalDaysFromNow ¶
GetRenewalDaysFromNow returns the RenewalDaysFromNow field if it's non-nil, zero value otherwise.
type CompanyListOptions ¶
type CompanyListOptions struct { // Limit the list length. Limit *int `url:"limit,omitempty"` // Start the list on a specific integer index. Offset *int `url:"offset,omitempty"` // Sort based on a specific property. Prefix the property "-" to change the sort order. Sort *string `url:"sort,omitempty"` }
CompanyListOptions represents query parameters for listing companies. They are pointer values in order to distinguish between unset fields and those with set to a zero value. Use the helper function planhat.Int() or planhat.String() to set the values.
func (*CompanyListOptions) GetLimit ¶
func (c *CompanyListOptions) GetLimit() int
GetLimit returns the Limit field if it's non-nil, zero value otherwise.
func (*CompanyListOptions) GetOffset ¶
func (c *CompanyListOptions) GetOffset() int
GetOffset returns the Offset field if it's non-nil, zero value otherwise.
func (*CompanyListOptions) GetSort ¶
func (c *CompanyListOptions) GetSort() string
GetSort returns the Sort field if it's non-nil, zero value otherwise.
type CompanyService ¶
type CompanyService struct {
// contains filtered or unexported fields
}
CompanyService represents the Company group
func (*CompanyService) BulkUpsert ¶
func (s *CompanyService) BulkUpsert(ctx context.Context, companies []Company) (*UpsertResponse, error)
BulkUpsert will update or insert companies. Note there is an upper limit of 50,000 items per request. For more information, see the [planhat docs](https://docs.planhat.com/#bulk_upsert)
func (*CompanyService) Delete ¶
func (s *CompanyService) Delete(ctx context.Context, id string) (*DeleteResponse, error)
Delete is used delete a company. It is required to pass the _id (ID).
func (*CompanyService) GetByExternalID ¶
GetByExternalID retrieves a company using it's external ID
func (*CompanyService) GetBySourceID ¶
GetBySourceID retrieves a company using it's source ID
func (*CompanyService) LeanList ¶
func (s *CompanyService) LeanList(ctx context.Context, options ...*LeanCompanyListOptions) ([]*LeanCompany, error)
LeanList returns a lightweight list of all companies in Planhat to match against your own ids etc.
func (*CompanyService) List ¶
func (s *CompanyService) List(ctx context.Context, options ...*CompanyListOptions) ([]*Company, error)
List will list companies based on the CompanyListOptions provided
func (*CompanyService) Update ¶
Update will update a planhat company. To update a company it is required to pass the company _id in the request. Alternately it is possible to update using the company externalId and/or sourceId adding a prefix and passing one of these keyables as identifiers. e.g. extid-{{externalId}} or srcid-{{sourceId}} Note you may get a Bad Request error if you include the ID in the company record
type DeleteResponse ¶
type DeleteResponse struct { N int `json:"n"` OK int `json:"ok"` DeletedCount int `json:"deletedCount"` }
DeleteResponse is returned by planhat when deleting an object
type DimensionData ¶
type DimensionData struct { ID string `json:"_id"` DimensionID string `json:"dimensionId"` Time time.Time `json:"time"` Value float64 `json:"value"` Model string `json:"model"` ParentID string `json:"parentId"` CompanyID string `json:"companyId"` CompanyName string `json:"companyName"` }
DimensionData represents metrics data from planhat for the list operation.
type EndUserService ¶
type EndUserService struct {
// contains filtered or unexported fields
}
EndUserService represents the End Users group
type LeanCompany ¶
type LeanCompany struct { ID string `json:"_id"` Name string `json:"name"` ExternalID string `json:"externalId"` SourceID string `json:"sourceId"` Slug string `json:"slug"` }
LeanCompany is the result of the Get lean list endpoint
type LeanCompanyListOptions ¶
type LeanCompanyListOptions struct { ExternalID *string `url:"externalId,omitempty"` SourceID *string `url:"sourceId,omitempty"` Status *string `url:"status,omitempty"` }
LeanCompanyListOptions represents query parameters for listing companies. They are pointer values in order to distinguish between unset fields and those with set to a zero value. Use the helper function planhat.String() to set the value.
func (*LeanCompanyListOptions) GetExternalID ¶
func (l *LeanCompanyListOptions) GetExternalID() string
GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (*LeanCompanyListOptions) GetSourceID ¶
func (l *LeanCompanyListOptions) GetSourceID() string
GetSourceID returns the SourceID field if it's non-nil, zero value otherwise.
func (*LeanCompanyListOptions) GetStatus ¶
func (l *LeanCompanyListOptions) GetStatus() string
GetStatus returns the Status field if it's non-nil, zero value otherwise.
type License ¶
type License struct { ID string `json:"_id"` ExternalID string `json:"externalId"` Value float64 `json:"value"` Currency struct { ID string `json:"_id"` Symbol string `json:"symbol"` Rate int `json:"rate"` IsBase bool `json:"isBase"` Overrides struct { } `json:"overrides"` } `json:"_currency"` FromDate time.Time `json:"fromDate"` ToDate time.Time `json:"toDate"` Product string `json:"product"` CompanyID string `json:"companyId"` Custom Custom `json:"custom"` CompanyName string `json:"companyName"` Status string `json:"status"` RenewalStatus string `json:"renewalStatus"` FixedPeriod bool `json:"fixedPeriod"` ToDateIncluded bool `json:"toDateIncluded"` Length float64 `json:"length"` Mrr float64 `json:"mrr"` RenewalPeriod float64 `json:"renewalPeriod"` RenewalUnit string `json:"renewalUnit"` RenewalDate time.Time `json:"renewalDate"` RenewalDaysFromNow int `json:"renewalDaysFromNow"` NoticePeriod float64 `json:"noticePeriod"` NoticeUnit string `json:"noticeUnit"` IsOverdue bool `json:"isOverdue"` }
License represents a planhat license
type Metric ¶
type Metric struct { // Any string without spaces or special characters. If you're sending "Share of Active Users" a good dimensionId // might be "activeusershare". It's not displayed in Planhat but will be used when building Health Metrics in // Planhat. Required. DimensionID *string `json:"dimensionId,omitempty"` // The raw (number) value you would like to set. Required. Value *float64 `json:"value,omitempty"` // This is the model (company by default) external id in your systems. For this to work the objects in Planhat // will need to have this externalId set. Required. ExternalID *string `json:"externalId,omitempty"` // Company (default), EndUser, Asset and Project models are supported Model *string `json:"model,omitempty"` // Pass a valid ISO format date string to specify the date of the event. In none is provided we will use the time the request was received. Date *string `json:"date,omitempty"` }
Metric represents an item that can be pushed to planhat.
func (*Metric) GetDimensionID ¶
GetDimensionID returns the DimensionID field if it's non-nil, zero value otherwise.
func (*Metric) GetExternalID ¶
GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
type MetricsListOptions ¶
type MetricsListOptions struct { // Id of company. CID *string `url:"cid,omitempty"` // Id of the dimension data. DimID *string `url:"dimid,omitempty"` // Days format integer representing the start day period (Days since January 1, 1970, Unix epoch). From *int `url:"from,omitempty"` // Days format integer representing the end day period (Days since January 1, 1970, Unix epoch). To *int `url:"to,omitempty"` // Limit the list length. Limit *int `url:"limit,omitempty"` // Start the list on a specific integer index. Offset *int `url:"offset,omitempty"` }
MetricsListOptions represents query parameters for listing metrics. They are pointer values in order to distinguish between unset fields and those with set to a zero value. Use the helper function planhat.Int() or planhat.String() to set the values.
func (*MetricsListOptions) GetCID ¶
func (m *MetricsListOptions) GetCID() string
GetCID returns the CID field if it's non-nil, zero value otherwise.
func (*MetricsListOptions) GetDimID ¶
func (m *MetricsListOptions) GetDimID() string
GetDimID returns the DimID field if it's non-nil, zero value otherwise.
func (*MetricsListOptions) GetFrom ¶
func (m *MetricsListOptions) GetFrom() int
GetFrom returns the From field if it's non-nil, zero value otherwise.
func (*MetricsListOptions) GetLimit ¶
func (m *MetricsListOptions) GetLimit() int
GetLimit returns the Limit field if it's non-nil, zero value otherwise.
func (*MetricsListOptions) GetOffset ¶
func (m *MetricsListOptions) GetOffset() int
GetOffset returns the Offset field if it's non-nil, zero value otherwise.
func (*MetricsListOptions) GetTo ¶
func (m *MetricsListOptions) GetTo() int
GetTo returns the To field if it's non-nil, zero value otherwise.
type MetricsService ¶
type MetricsService struct {
// contains filtered or unexported fields
}
MetricsService represents the Metrics methods
func (*MetricsService) BulkUpsert ¶
func (s *MetricsService) BulkUpsert(ctx context.Context, metrics []Metric) (*UpsertMetricsResponse, error)
BulkUpsert will update metrics. To push dimension data into Planhat it is required to specify the Tenant Token (tenantUUID) in the request URL. This token is a simple uui identifier for your tenant and it can be found in the Developer module under the Tokens section. Set the TenantUUID on the planhat Client. For more information, see the [planhat docs](https://docs.planhat.com/#bulkupsert_metrics)
func (*MetricsService) List ¶
func (s *MetricsService) List(ctx context.Context, options ...*MetricsListOptions) ([]*DimensionData, error)
List returns a list of DimensionData items as per the documentation https://docs.planhat.com/#get_metrics
type UpsertMetricsResponse ¶
type UpsertMetricsResponse struct { Processed int `json:"processed"` Errors []interface{} `json:"errors"` }
UpsertMetricsResponse is the result of a bulk upsert operation as documented in the [planhat docs](https://docs.planhat.com/#bulkupsert_metrics). Note the use of slices of empty interfaces due to the lack of documentation on what an error object is.
type UpsertResponse ¶
type UpsertResponse struct { Created int `json:"created"` CreatedErrors []interface{} `json:"createdErrors"` InsertsKeys []interface{} `json:"insertsKeys"` Updated int `json:"updated"` UpdatedErrors []interface{} `json:"updatedErrors"` UpdatesKeys []interface{} `json:"updatesKeys"` NonUpdates int `json:"nonupdates"` Modified []string `json:"modified"` UpsertedIDs []string `json:"upsertedIds"` PermissionErrors []interface{} `json:"permissionErrors"` }
UpsertResponse is the result of a bulk upsert operation as documented in the [planhat docs](https://docs.planhat.com/#bulk_upsert). Note the use of slices of empty interfaces due to the lack of documentation on what an error object etc. are
type User ¶
type User struct { ID *string `json:"_id,omitempty"` SkippedGettingStartedSteps struct { Email *bool `json:"email,omitempty"` Linkedin *bool `json:"linkedin,omitempty"` Avatar *bool `json:"avatar,omitempty"` All *bool `json:"all,omitempty"` Team *bool `json:"team,omitempty"` Customers *bool `json:"customers,omitempty"` } `json:"skippedGettingStartedSteps,omitempty"` Image struct { Path *string `json:"path,omitempty"` } `json:"image,omitempty"` FirstName *string `json:"firstName,omitempty"` LastName *string `json:"lastName,omitempty"` IsHidden *bool `json:"isHidden,omitempty"` Removed *bool `json:"removed,omitempty"` Inactive *bool `json:"inactive,omitempty"` CompressedView *bool `json:"compressedView,omitempty"` CompanyFilter *string `json:"companyFilter,omitempty"` TaskFilter *string `json:"taskFilter,omitempty"` WorkflowFilter *string `json:"workflowFilter,omitempty"` PlayLogDisabled *bool `json:"playLogDisabled,omitempty"` RadarOneLine *bool `json:"radarOneLine,omitempty"` CollapsedFolders []string `json:"collapsedFolders,omitempty"` RevReportPeriodType *string `json:"revReportPeriodType,omitempty"` SplitLayoutDisabled *bool `json:"splitLayoutDisabled,omitempty"` DailyDigest *bool `json:"dailyDigest,omitempty"` FollowerUpdate *bool `json:"followerUpdate,omitempty"` InAppNotifications *bool `json:"inAppNotifications,omitempty"` LastVisitedCompanies []string `json:"lastVisitedCompanies,omitempty"` LastVisitedEndusers []string `json:"lastVisitedEndusers,omitempty"` Roles []struct { ID *string `json:"_id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` V *int `json:"__v,omitempty"` } `json:"roles,omitempty"` IsExposedAsSenderOption *bool `json:"isExposedAsSenderOption,omitempty"` DefaultMeetingLength *int `json:"defaultMeetingLength,omitempty"` NickName *string `json:"nickName,omitempty"` Email *string `json:"email,omitempty"` CreateDate *time.Time `json:"createDate,omitempty"` V *int `json:"__v,omitempty"` RecentOpenTabs *struct { Customers *string `json:"customers,omitempty"` Bi *string `json:"bi,omitempty"` BiSystem *string `json:"bi-system,omitempty"` BiAnalytics *string `json:"bi-analytics,omitempty"` People *string `json:"people,omitempty"` Tasks *string `json:"tasks,omitempty"` Conversations *string `json:"conversations,omitempty"` ConversationsOutbox *string `json:"conversations-outbox,omitempty"` Engage *string `json:"engage,omitempty"` Nps *string `json:"nps,omitempty"` Revenue *string `json:"revenue,omitempty"` Settings *string `json:"settings,omitempty"` Team *string `json:"team,omitempty"` } `json:"recentOpenTabs,omitempty"` RecentOpenPage *string `json:"recentOpenPage,omitempty"` Segment *string `json:"segment,omitempty"` BubbleChartSettings struct { XParam *string `json:"xParam,omitempty"` YParam *string `json:"yParam,omitempty"` } `json:"bubbleChartSettings,omitempty"` RecentTabSearches struct { BaseTasksAssigned *string `json:"base-tasks-assigned,omitempty"` } `json:"recentTabSearches,omitempty"` GoogleAPI struct { AccessEnabled *bool `json:"accessEnabled,omitempty"` SyncEnabled *bool `json:"syncEnabled,omitempty"` SyncInitial *bool `json:"syncInitial,omitempty"` SyncedLabels []interface{} `json:"syncedLabels,omitempty"` } `json:"googleApi,omitempty"` MsAPI struct { AccessEnabled *bool `json:"accessEnabled,omitempty"` SyncEnabled *bool `json:"syncEnabled,omitempty"` SyncInitial *bool `json:"syncInitial,omitempty"` SyncedLabels []interface{} `json:"syncedLabels,omitempty"` } `json:"msApi,omitempty"` GoogleCalendarAPI struct { AccessEnabled *bool `json:"accessEnabled,omitempty"` SyncEnabled *bool `json:"syncEnabled,omitempty"` SyncInitial *bool `json:"syncInitial,omitempty"` SyncedCalendars []interface{} `json:"syncedCalendars,omitempty"` CalendarToSave struct { } `json:"calendarToSave,omitempty"` } `json:"googleCalendarApi,omitempty"` }
User represents a planhat user
func (*User) GetCompanyFilter ¶
GetCompanyFilter returns the CompanyFilter field if it's non-nil, zero value otherwise.
func (*User) GetCompressedView ¶
GetCompressedView returns the CompressedView field if it's non-nil, zero value otherwise.
func (*User) GetCreateDate ¶
GetCreateDate returns the CreateDate field if it's non-nil, zero value otherwise.
func (*User) GetDailyDigest ¶
GetDailyDigest returns the DailyDigest field if it's non-nil, zero value otherwise.
func (*User) GetDefaultMeetingLength ¶
GetDefaultMeetingLength returns the DefaultMeetingLength field if it's non-nil, zero value otherwise.
func (*User) GetFirstName ¶
GetFirstName returns the FirstName field if it's non-nil, zero value otherwise.
func (*User) GetFollowerUpdate ¶
GetFollowerUpdate returns the FollowerUpdate field if it's non-nil, zero value otherwise.
func (*User) GetInAppNotifications ¶
GetInAppNotifications returns the InAppNotifications field if it's non-nil, zero value otherwise.
func (*User) GetInactive ¶
GetInactive returns the Inactive field if it's non-nil, zero value otherwise.
func (*User) GetIsExposedAsSenderOption ¶
GetIsExposedAsSenderOption returns the IsExposedAsSenderOption field if it's non-nil, zero value otherwise.
func (*User) GetIsHidden ¶
GetIsHidden returns the IsHidden field if it's non-nil, zero value otherwise.
func (*User) GetLastName ¶
GetLastName returns the LastName field if it's non-nil, zero value otherwise.
func (*User) GetNickName ¶
GetNickName returns the NickName field if it's non-nil, zero value otherwise.
func (*User) GetPlayLogDisabled ¶
GetPlayLogDisabled returns the PlayLogDisabled field if it's non-nil, zero value otherwise.
func (*User) GetRadarOneLine ¶
GetRadarOneLine returns the RadarOneLine field if it's non-nil, zero value otherwise.
func (*User) GetRecentOpenPage ¶
GetRecentOpenPage returns the RecentOpenPage field if it's non-nil, zero value otherwise.
func (*User) GetRemoved ¶
GetRemoved returns the Removed field if it's non-nil, zero value otherwise.
func (*User) GetRevReportPeriodType ¶
GetRevReportPeriodType returns the RevReportPeriodType field if it's non-nil, zero value otherwise.
func (*User) GetSegment ¶
GetSegment returns the Segment field if it's non-nil, zero value otherwise.
func (*User) GetSplitLayoutDisabled ¶
GetSplitLayoutDisabled returns the SplitLayoutDisabled field if it's non-nil, zero value otherwise.
func (*User) GetTaskFilter ¶
GetTaskFilter returns the TaskFilter field if it's non-nil, zero value otherwise.
func (*User) GetWorkflowFilter ¶
GetWorkflowFilter returns the WorkflowFilter field if it's non-nil, zero value otherwise.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService represents the Users group