Documentation ¶
Index ¶
- Constants
- Variables
- func FeePercentage(date time.Time) float64
- func PaidOutPercentage(date time.Time) float64
- type AccountType
- type Amount
- type ChurnedCustomer
- type ChurnedCustomerList
- type ChurnedCustomers
- func (c ChurnedCustomers) ChurnRatePercentage() float64
- func (c ChurnedCustomers) Contains(id CustomerID) bool
- func (c ChurnedCustomers) Count() int
- func (c ChurnedCustomers) CountAnnual() int
- func (c ChurnedCustomers) CountMonthly() int
- func (c ChurnedCustomers) Customers() Customers
- func (c ChurnedCustomers) GroupByPaidDuration(first CustomerDateMap) []NumberedGroup
- func (c ChurnedCustomers) IsNotEmpty() bool
- func (c ChurnedCustomers) SortedByDate() ChurnedCustomerList
- func (c ChurnedCustomers) SortedByDayOfMonth() ChurnedCustomerList
- type Client
- type CountrySales
- type CountryTransactions
- type Currency
- type CurrencySales
- type Customer
- type CustomerDateMap
- type CustomerID
- type CustomerSales
- type CustomerSalesMap
- type CustomerTransactionMap
- type Customers
- type CustomersMap
- type DateGroupedSales
- type DateGroupedTransactions
- type DownloadAndDate
- type DownloadData
- type DownloadMonthly
- type DownloadResponse
- type Filter
- type GroupedCustomers
- type GroupedSales
- type NameValuePair
- type NumberedGroup
- type PluginInfo
- type PurchaseInfo
- type Rating
- type Sale
- type Sales
- func (s Sales) After(date time.Time) Sales
- func (s Sales) AtOrAfter(date time.Time) Sales
- func (s Sales) Before(date time.Time) Sales
- func (s Sales) ByAccountType(subscription AccountType) Sales
- func (s Sales) ByAnnualSubscription() Sales
- func (s Sales) ByCustomer(c Customer) Sales
- func (s Sales) ByDateRange(begin, end YearMonthDay) Sales
- func (s Sales) ByDay(date time.Time) Sales
- func (s Sales) ByFreeSubscription() Sales
- func (s Sales) ByMonth(year int, month time.Month) Sales
- func (s Sales) ByMonthlySubscription() Sales
- func (s Sales) ByNewCustomers(allPreviousSales Sales, referenceDate time.Time) Sales
- func (s Sales) ByReturnedCustomers(previouslyChurned ChurnedCustomerList) Sales
- func (s Sales) ByWeek(year int, isoWeek int) Sales
- func (s Sales) ByYear(year int) Sales
- func (s Sales) ByYearMonth(month YearMonth) Sales
- func (s Sales) ByYearMonthDay(day YearMonthDay) Sales
- func (s Sales) CountrySales() []*CountrySales
- func (s Sales) CustomerCount() int
- func (s Sales) CustomerSales() []*CustomerSales
- func (s Sales) CustomerSalesMap() CustomerSalesMap
- func (s Sales) CustomerTypeSales() []GroupedSales
- func (s Sales) Customers() Customers
- func (s Sales) CustomersFirstPurchase() CustomerDateMap
- func (s Sales) CustomersLastPurchase() CustomerDateMap
- func (s Sales) CustomersMap() CustomersMap
- func (s Sales) FeeSumUSD() Amount
- func (s Sales) FilterBy(keep func(Sale) bool) Sales
- func (s Sales) GroupByCurrency() []*CurrencySales
- func (s Sales) GroupByDate(newestDateFirst bool) []DateGroupedSales
- func (s Sales) GroupByWeekday() []GroupedSales
- func (s Sales) PaidOutUSD() Amount
- func (s Sales) Reversed() Sales
- func (s Sales) SortedByDate() Sales
- func (s Sales) SubscriptionSales() []GroupedSales
- func (s Sales) TotalSumUSD() Amount
- type ScreenshotInfo
- type Subscription
- type Tag
- type Transaction
- type Transactions
- func (t Transactions) Before(date time.Time) Transactions
- func (t Transactions) ByYearMonth(month YearMonth) Transactions
- func (t Transactions) FilterBy(keep func(transaction Transaction) bool) Transactions
- func (t Transactions) GroupByCountry() []CountryTransactions
- func (t Transactions) GroupByCustomer() CustomerTransactionMap
- func (t Transactions) GroupByDate(newestDateFirst bool) []DateGroupedTransactions
- func (t Transactions) SortedByDate() Transactions
- type Vendor
- type YearMonth
- func (y YearMonth) Add(years, months, days int) YearMonth
- func (y YearMonth) AsDate() time.Time
- func (y YearMonth) ContainsDate(date time.Time) bool
- func (y YearMonth) Equals(o YearMonth) bool
- func (y YearMonth) IsAfter(o YearMonth) bool
- func (y YearMonth) Month() time.Month
- func (y YearMonth) NextMonth() YearMonth
- func (y YearMonth) PreviousMonth() YearMonth
- func (y YearMonth) String() string
- func (y YearMonth) Year() int
- type YearMonthDay
- func (d YearMonthDay) Add(years, months, days int) YearMonthDay
- func (d YearMonthDay) AddDays(days int) YearMonthDay
- func (d YearMonthDay) AsDate() time.Time
- func (d YearMonthDay) AsYearMonth() YearMonth
- func (d YearMonthDay) Day() int
- func (d YearMonthDay) Equals(o YearMonthDay) bool
- func (d YearMonthDay) IsAfter(o YearMonthDay) bool
- func (d YearMonthDay) IsBefore(o YearMonthDay) bool
- func (d YearMonthDay) Month() time.Month
- func (d YearMonthDay) NextDay() YearMonthDay
- func (d YearMonthDay) String() string
- func (d YearMonthDay) Year() int
Constants ¶
const ( AnnualSubscription Subscription = "Annual" MonthlySubscription Subscription = "Monthly" AccountTypePersonal AccountType = "Personal" AccountTypeOrganization AccountType = "Organization" )
Variables ¶
var ServerTimeZone, _ = time.LoadLocation("Europe/Berlin")
Functions ¶
func FeePercentage ¶
func PaidOutPercentage ¶
Types ¶
type AccountType ¶
type AccountType string
AccountType is either a Personal or an Organization account
type ChurnedCustomer ¶
type ChurnedCustomer struct { Customer LastPurchase YearMonthDay Subscription Subscription FreeSubscription bool }
func (ChurnedCustomer) PaidDuration ¶
func (c ChurnedCustomer) PaidDuration(first YearMonthDay) string
type ChurnedCustomerList ¶
type ChurnedCustomerList []ChurnedCustomer
func (ChurnedCustomerList) Customers ¶ added in v0.6.0
func (c ChurnedCustomerList) Customers() Customers
type ChurnedCustomers ¶
type ChurnedCustomers struct { ChurnedCustomers ChurnedCustomerList ActiveUserCount int }
func NewChurnedCustomers ¶
func NewChurnedCustomers(customers []ChurnedCustomer) ChurnedCustomers
func (ChurnedCustomers) ChurnRatePercentage ¶
func (c ChurnedCustomers) ChurnRatePercentage() float64
func (ChurnedCustomers) Contains ¶
func (c ChurnedCustomers) Contains(id CustomerID) bool
func (ChurnedCustomers) Count ¶
func (c ChurnedCustomers) Count() int
func (ChurnedCustomers) CountAnnual ¶
func (c ChurnedCustomers) CountAnnual() int
func (ChurnedCustomers) CountMonthly ¶
func (c ChurnedCustomers) CountMonthly() int
func (ChurnedCustomers) Customers ¶
func (c ChurnedCustomers) Customers() Customers
func (ChurnedCustomers) GroupByPaidDuration ¶
func (c ChurnedCustomers) GroupByPaidDuration(first CustomerDateMap) []NumberedGroup
func (ChurnedCustomers) IsNotEmpty ¶
func (c ChurnedCustomers) IsNotEmpty() bool
func (ChurnedCustomers) SortedByDate ¶
func (c ChurnedCustomers) SortedByDate() ChurnedCustomerList
func (ChurnedCustomers) SortedByDayOfMonth ¶
func (c ChurnedCustomers) SortedByDayOfMonth() ChurnedCustomerList
type Client ¶
type Client interface { GetCurrentPluginInfo() (PluginInfo, error) GetPluginInfo(id string) (PluginInfo, error) GetCurrentPluginRating() (Rating, error) GetPluginRating(id string) (Rating, error) DownloadsMonthly(uniqueDownloads bool, channel, build, product, country, productCommonCode string) ([]DownloadMonthly, error) DownloadsWeekly(uniqueDownloads bool, channel, build, product, country, productCommonCode string) ([]DownloadAndDate, error) DownloadsDaily(uniqueDownloads bool, channel, build, product, country, productCommonCode string) ([]DownloadAndDate, error) Downloads(period string, uniqueDownloads bool, channel, build, product, country, productCommonCode string) (DownloadResponse, error) // GetAllSalesInfo returns the sales of the complete lifespan of the plugin GetAllSalesInfo() (Sales, error) // GetSalesInfo returns the sales in the given range. // If it covers more than one year, then the sales will be fetched in yearly chunks. GetSalesInfo(beginDate, endDate YearMonthDay) (Sales, error) // GetAllTrialsInfo returns the trial license data of the complete lifespan of the plugin GetAllTrialsInfo() (Transactions, error) // GetTrialsInfo returns the trial license data of the given range. // If it covers more than one year, then the sales will be fetched in yearly chunks. GetTrialsInfo(beginDate, endDate YearMonthDay) (Transactions, error) // GetJSON performs a generic request to the marketplace, it expects that JSON data is returned GetJSON(path string, params map[string]string, target interface{}) error }
type CountrySales ¶
CountrySales contains the sales of a specific country.
type CountryTransactions ¶ added in v0.8.0
type CountryTransactions struct { Country string Transactions Transactions }
type CurrencySales ¶
type CurrencySales struct { // Currency is the currency used in this struct Currency Currency // TotalSales is the sum of all sales in currency "Currency" TotalSales Amount // TotalSalesUSD is the sum of all sales, but in USD TotalSalesUSD Amount // Sales Sales Sales }
CurrencySales contains the sales in a certain currency.
type Customer ¶
type Customer struct { ID CustomerID `json:"code"` Name string `json:"name"` Country string `json:"country"` Type AccountType `json:"type"` }
Customer defines a specific customer
func NewCustomer ¶
func NewCustomer(id CustomerID, name, country string, accountType AccountType) Customer
NewCustomer returns a new customer
type CustomerDateMap ¶
type CustomerDateMap map[CustomerID]YearMonthDay
CustomerDateMap maps a customer ID to a YearMonthDate
type CustomerID ¶
type CustomerID int
CustomerID identifies a specific customer, this is used by the JetBrains API
type CustomerSales ¶
CustomerSales contains the sales of a specific customer
func (*CustomerSales) FirstPurchase ¶
func (c *CustomerSales) FirstPurchase() YearMonthDay
FirstPurchase returns the first purchase of this customer. If there are no sales, then the zero value of time.Time is returned.
func (*CustomerSales) LatestPurchase ¶
func (c *CustomerSales) LatestPurchase() time.Time
LatestPurchase returns the latest purchase of this customer. If there are no sales, then the zero value of time.Time is returned.
type CustomerSalesMap ¶
type CustomerSalesMap map[CustomerID]*CustomerSales
func (CustomerSalesMap) GroupByPaidMonths ¶
func (m CustomerSalesMap) GroupByPaidMonths(customers Customers, before time.Time) []NumberedGroup
func (CustomerSalesMap) PaidMonths ¶
func (m CustomerSalesMap) PaidMonths(id CustomerID, before time.Time) int
func (CustomerSalesMap) TotalSales ¶
func (m CustomerSalesMap) TotalSales(id CustomerID) Amount
type CustomerTransactionMap ¶ added in v0.8.0
type CustomerTransactionMap map[CustomerID]Transactions
func (CustomerTransactionMap) RetainCustomers ¶ added in v0.8.0
func (t CustomerTransactionMap) RetainCustomers(retained []Customer) CustomerTransactionMap
type Customers ¶
type Customers []Customer
Customers defines a slice of Customer
func (Customers) AsMap ¶
func (c Customers) AsMap() CustomersMap
func (Customers) GroupByCountry ¶
func (c Customers) GroupByCountry() []GroupedCustomers
func (Customers) SortByDateMapping ¶
func (c Customers) SortByDateMapping(mapping CustomerDateMap) Customers
SortByID returns a slice sorted by the date of first purchase
type CustomersMap ¶
type CustomersMap map[CustomerID]Customer
CustomersMap maps a customer ID to customer
func (CustomersMap) Without ¶
func (m CustomersMap) Without(customersMap CustomersMap) CustomersMap
type DateGroupedSales ¶
type DateGroupedSales struct { Date YearMonthDay Name string TotalUSD Amount Sales Sales }
DateGroupedSales is a number of sales, which have a group name and a date
type DateGroupedTransactions ¶ added in v0.8.0
type DateGroupedTransactions struct { Date YearMonthDay Transactions Transactions }
DateGroupedTransactions defines a basic transaction tied to a date
type DownloadAndDate ¶
func (DownloadAndDate) Date ¶
func (d DownloadAndDate) Date() YearMonthDay
type DownloadData ¶
type DownloadData struct { Dimension string `json:"dimension"` Serie []NameValuePair }
type DownloadMonthly ¶
func (DownloadMonthly) Date ¶
func (d DownloadMonthly) Date() YearMonth
type DownloadResponse ¶
type DownloadResponse struct { Measure string `json:"measure"` Filters []Filter Dimension1 string `json:"dim1"` Data DownloadData }
type GroupedCustomers ¶
GroupedCustomers is a name with a list of customers
type GroupedSales ¶
GroupedSales is a number of sales, which have a group name
type NameValuePair ¶
type NumberedGroup ¶
NumberedGroup is a name with a count
type PluginInfo ¶
type PluginInfo struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Link string `json:"link"` Approved bool `json:"approve"` XmlID string `json:"xmlId"` CustomIdeList bool `json:"customIdeList"` PreviewText string `json:"preview"` ContactEmail string `json:"email"` Copyright string `json:"copyright"` Downloads int `json:"downloads"` PurchaseInfo PurchaseInfo URLs map[string]json.RawMessage `json:"urls"` Tags []Tag `json:"tags"` RemovalRequested bool `json:"removalRequested"` HasUnapprovedUpdate bool `json:"hasUnapprovedUpdate"` ReadyForSale bool `json:"readyForSale"` IconMarketplacePath string `json:"icon"` }
type PurchaseInfo ¶
type PurchaseInfo struct {
ProductCode string `json:"productCode"`
}
type Rating ¶ added in v0.6.0
type Rating struct { MeanRating float64 `json:"meanRating"` MeanVotes int `json:"meanVotes"` UserRating int `json:"userRating"` Votes map[string]int `json:"votes"` }
func (Rating) CalculateRating ¶ added in v0.6.0
func (Rating) VotesCount ¶ added in v0.6.0
type Sale ¶
type Sale struct { Transaction // Amount is the amount paid by the customer, in currency 'Currency' Amount Amount `json:"amount"` // Currency is the currency of the transaction Currency Currency `json:"currency"` // AmountUSD is Amount, converted into USD. This value is returned by the JetBrains API. AmountUSD Amount `json:"amountUSD"` // Period defines, if the transaction was for a monthly or annual license Period Subscription `json:"period"` }
Sale represents a single transaction. Its structure is defined by the JetBrains API
func (Sale) ExchangeRate ¶
ExchangeRate returns the exchange rate of AmountUSD / Amount
func (Sale) FeeAmount ¶
FeeAmount returns the fee, in the currency of this sale, which is paid to JetBrains.
func (Sale) FeeAmountUSD ¶
FeeAmountUSD is the fee in USD, which is paid to JetBrains.
func (Sale) IsFreeSubscription ¶
IsFreeSubscription returns true if the amount was 0, which indicates a free license
type Sales ¶
type Sales []Sale
Sales is a slice of sales. It offers a wide range of methods to aggregate the data.
func (Sales) ByAccountType ¶
func (s Sales) ByAccountType(subscription AccountType) Sales
func (Sales) ByAnnualSubscription ¶
func (Sales) ByCustomer ¶
func (Sales) ByDateRange ¶
func (s Sales) ByDateRange(begin, end YearMonthDay) Sales
ByDateRange returns a new Sales slice, which contains all items bought in the given date range (inclusive)
func (Sales) ByDay ¶
ByDay returns a new Sales slice, which contains all items bought at this particular day
func (Sales) ByFreeSubscription ¶
func (Sales) ByMonthlySubscription ¶
func (Sales) ByNewCustomers ¶
func (Sales) ByReturnedCustomers ¶ added in v0.6.0
func (s Sales) ByReturnedCustomers(previouslyChurned ChurnedCustomerList) Sales
func (Sales) ByWeek ¶
ByWeek returns a new Sales slice, which contains all items bought in the week of the year
func (Sales) ByYearMonth ¶
ByYearMonth returns a new Sales slice, which contains all items bought in the particular month
func (Sales) ByYearMonthDay ¶
func (s Sales) ByYearMonthDay(day YearMonthDay) Sales
ByYearMonthDay returns a new Sales slice, which contains all items bought at this particular day
func (Sales) CountrySales ¶
func (s Sales) CountrySales() []*CountrySales
func (Sales) CustomerCount ¶
func (Sales) CustomerSales ¶
func (s Sales) CustomerSales() []*CustomerSales
func (Sales) CustomerSalesMap ¶
func (s Sales) CustomerSalesMap() CustomerSalesMap
func (Sales) CustomerTypeSales ¶
func (s Sales) CustomerTypeSales() []GroupedSales
func (Sales) CustomersFirstPurchase ¶
func (s Sales) CustomersFirstPurchase() CustomerDateMap
func (Sales) CustomersLastPurchase ¶
func (s Sales) CustomersLastPurchase() CustomerDateMap
func (Sales) CustomersMap ¶
func (s Sales) CustomersMap() CustomersMap
func (Sales) FilterBy ¶
FilterBy returns a new Sales slice, which contains all items, were the keep function returned true
func (Sales) GroupByCurrency ¶
func (s Sales) GroupByCurrency() []*CurrencySales
sales in currencies, sorted by USD
func (Sales) GroupByDate ¶
func (s Sales) GroupByDate(newestDateFirst bool) []DateGroupedSales
sales, grouped by year-month-day
func (Sales) GroupByWeekday ¶
func (s Sales) GroupByWeekday() []GroupedSales
func (Sales) PaidOutUSD ¶
func (Sales) SortedByDate ¶
func (Sales) SubscriptionSales ¶
func (s Sales) SubscriptionSales() []GroupedSales
func (Sales) TotalSumUSD ¶
type ScreenshotInfo ¶
type Subscription ¶
type Subscription string
Subscription is either an Annual or a Monthly subscription
func (Subscription) Abbrev ¶
func (s Subscription) Abbrev() string
type Transaction ¶ added in v0.8.0
type Transaction struct { // ReferenceID is a unique ID of this transaction ReferenceID string `json:"ref"` // Date, depends on source. Either the day, when the sale was mode or when the trial expires. Date YearMonthDay `json:"date"` // Customer defines the customer, who paid for the license Customer Customer `json:"customer"` }
Transaction contains basic information about a transaction
func NewTransaction ¶ added in v0.8.0
func NewTransaction(refId string, date YearMonthDay, customer Customer) Transaction
type Transactions ¶ added in v0.8.0
type Transactions []Transaction
func (Transactions) Before ¶ added in v0.8.0
func (t Transactions) Before(date time.Time) Transactions
func (Transactions) ByYearMonth ¶ added in v0.8.0
func (t Transactions) ByYearMonth(month YearMonth) Transactions
ByYearMonth returns a new Transactions slice, which contains all items bought in the particular month
func (Transactions) FilterBy ¶ added in v0.8.0
func (t Transactions) FilterBy(keep func(transaction Transaction) bool) Transactions
FilterBy returns a new Sales slice, which contains all items, were the keep function returned true
func (Transactions) GroupByCountry ¶ added in v0.8.0
func (t Transactions) GroupByCountry() []CountryTransactions
GroupByCountry returns transactions, grouped by customer's country. The result is sorted by number of transactions
func (Transactions) GroupByCustomer ¶ added in v0.8.0
func (t Transactions) GroupByCustomer() CustomerTransactionMap
func (Transactions) GroupByDate ¶ added in v0.8.0
func (t Transactions) GroupByDate(newestDateFirst bool) []DateGroupedTransactions
GroupByDate groups transactions by date
func (Transactions) SortedByDate ¶ added in v0.8.0
func (t Transactions) SortedByDate() Transactions
type Vendor ¶
type Vendor struct { ID int `json:"vendorId"` Name string `json:"name"` PublicName string `json:"publicName"` Email string `json:"email"` CountryCode string `json:"countryCode"` Country string `json:"country"` City string `json:"city"` ZipCode string `json:"zipCode"` URL string `json:"url"` MarketplacePath string `json:"link"` TotalPlugins int `json:"totalPlugins"` TotalUsers int `json:"totalUsers"` Verified bool `json:"isVerified"` ServicesDescription []string `json:"servicesDescription"` }
type YearMonth ¶
type YearMonth [2]int
YearMonth represents year, month
func NewYearMonthByDate ¶
func (YearMonth) PreviousMonth ¶
type YearMonthDay ¶
type YearMonthDay [3]int
YearMonthDay represents year, month, day
func NewYearMonthDay ¶
func NewYearMonthDay(year, month, day int) YearMonthDay
func NewYearMonthDayByDate ¶
func NewYearMonthDayByDate(date time.Time) YearMonthDay
func (YearMonthDay) Add ¶
func (d YearMonthDay) Add(years, months, days int) YearMonthDay
func (YearMonthDay) AddDays ¶
func (d YearMonthDay) AddDays(days int) YearMonthDay
func (YearMonthDay) AsDate ¶
func (d YearMonthDay) AsDate() time.Time
func (YearMonthDay) AsYearMonth ¶
func (d YearMonthDay) AsYearMonth() YearMonth
func (YearMonthDay) Day ¶
func (d YearMonthDay) Day() int
func (YearMonthDay) Equals ¶
func (d YearMonthDay) Equals(o YearMonthDay) bool
func (YearMonthDay) IsAfter ¶
func (d YearMonthDay) IsAfter(o YearMonthDay) bool
func (YearMonthDay) IsBefore ¶
func (d YearMonthDay) IsBefore(o YearMonthDay) bool
func (YearMonthDay) Month ¶
func (d YearMonthDay) Month() time.Month
func (YearMonthDay) NextDay ¶
func (d YearMonthDay) NextDay() YearMonthDay
func (YearMonthDay) String ¶
func (d YearMonthDay) String() string
func (YearMonthDay) Year ¶
func (d YearMonthDay) Year() int