appstore

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 20 Imported by: 0

README

AppStore Connect API SDK GO (Unofficial)

Build Status Codecov Go Report Card Version Release License GoDoc Mentioned in Awesome Go

Description

Unofficial Golang SDK for AppStore Connect API

API documentation

https://developer.apple.com/documentation/appstoreconnectapi/download_finance_reports

https://developer.apple.com/documentation/appstoreconnectapi/download_sales_and_trends_reports

Download

go get -u github.com/kachit/appstore-sdk-go

Usage

package main

import (
    "fmt"
    "time"
    appstore_sdk "github.com/kachit/appstore-sdk-go"
)

func main(){
    cfg := appstore_sdk.NewConfig("Issuer Id", "Key Id", "Vendor No", "path/to/your/private.key")
    client := appstore_sdk.NewClientFromConfig(cfg, nil)
    
    //Build auth token
    err := client.Init()
    if err != nil {
        fmt.Printf("Wrong API client init " + err.Error())
        panic(err)
    }
}
Get sales reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewSalesReportsFilter()
filter.SubTypeSummary().Version10().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetSalesReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].Provider)
fmt.Println(result.Data[0].ProviderCountry)
fmt.Println(result.Data[0].SKU)
fmt.Println(result.Data[0].Developer)
fmt.Println(result.Data[0].Title)
fmt.Println(result.Data[0].Version)
fmt.Println(result.Data[0].ProductTypeIdentifier)
fmt.Println(result.Data[0].Units.Value())
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].DeveloperProceeds.Value())
fmt.Println(result.Data[0].BeginDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].EndDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].CustomerCurrency)
fmt.Println(result.Data[0].CountryCode)
fmt.Println(result.Data[0].CurrencyOfProceeds)
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].CustomerPrice.Value())
fmt.Println(result.Data[0].PromoCode)
fmt.Println(result.Data[0].ParentIdentifier)
fmt.Println(result.Data[0].Subscription)
fmt.Println(result.Data[0].Period)
fmt.Println(result.Data[0].Category)
fmt.Println(result.Data[0].CMB)
fmt.Println(result.Data[0].Device)
fmt.Println(result.Data[0].SupportedPlatforms)
fmt.Println(result.Data[0].ProceedsReason)
fmt.Println(result.Data[0].PreservedPricing)
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].OrderType)
Get subscriptions reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewSubscriptionsReportsFilter()
filter.SubTypeSummary().Version12().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetSubscriptionsReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].AppName)
fmt.Println(result.Data[0].AppAppleID.Value())
fmt.Println(result.Data[0].SubscriptionName)
fmt.Println(result.Data[0].SubscriptionAppleID.Value())
fmt.Println(result.Data[0].SubscriptionGroupID.Value())
fmt.Println(result.Data[0].StandardSubscriptionDuration)
fmt.Println(result.Data[0].PromotionalOfferName)
fmt.Println(result.Data[0].PromotionalOfferID)
fmt.Println(result.Data[0].CustomerPrice.Value())
fmt.Println(result.Data[0].CustomerCurrency)
fmt.Println(result.Data[0].DeveloperProceeds.Value())
fmt.Println(result.Data[0].ProceedsCurrency)
fmt.Println(result.Data[0].PreservedPricing)
fmt.Println(result.Data[0].ProceedsReason)
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].Device)
fmt.Println(result.Data[0].State)
fmt.Println(result.Data[0].Country)
fmt.Println(result.Data[0].ActiveStandardPriceSubscriptions.Value())
fmt.Println(result.Data[0].ActiveFreeTrialIntroductoryOfferSubscriptions.Value())
fmt.Println(result.Data[0].ActivePayUpFrontIntroductoryOfferSubscriptions.Value())
fmt.Println(result.Data[0].ActivePayAsYouGoIntroductoryOfferSubscriptions.Value())
fmt.Println(result.Data[0].FreeTrialPromotionalOfferSubscriptions.Value())
fmt.Println(result.Data[0].PayUpFrontPromotionalOfferSubscriptions.Value())
fmt.Println(result.Data[0].PayAsYouGoPromotionalOfferSubscriptions.Value())
fmt.Println(result.Data[0].MarketingOptIns.Value())
fmt.Println(result.Data[0].BillingRetry.Value())
fmt.Println(result.Data[0].GracePeriod.Value())
Get subscriptions events reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewSubscriptionsEventsReportsFilter()
filter.SubTypeSummary().Version12().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetSubscriptionsEventsReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].EventDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].Event)
fmt.Println(result.Data[0].AppName)
fmt.Println(result.Data[0].AppAppleID.Value())
fmt.Println(result.Data[0].SubscriptionName)
fmt.Println(result.Data[0].SubscriptionAppleID.Value())
fmt.Println(result.Data[0].SubscriptionGroupID.Value())
fmt.Println(result.Data[0].StandardSubscriptionDuration)
fmt.Println(result.Data[0].PromotionalOfferName)
fmt.Println(result.Data[0].PromotionalOfferID)
fmt.Println(result.Data[0].SubscriptionOfferType)
fmt.Println(result.Data[0].SubscriptionOfferDuration)
fmt.Println(result.Data[0].MarketingOptIn)
fmt.Println(result.Data[0].MarketingOptInDuration)
fmt.Println(result.Data[0].PreservedPricing)
fmt.Println(result.Data[0].ProceedsReason)
fmt.Println(result.Data[0].ConsecutivePaidPeriods.Value())
fmt.Println(result.Data[0].OriginalStartDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].Device)
fmt.Println(result.Data[0].State)
fmt.Println(result.Data[0].Country)
fmt.Println(result.Data[0].PreviousSubscriptionName)
fmt.Println(result.Data[0].PreviousSubscriptionAppleID.Value())
fmt.Println(result.Data[0].DaysBeforeCanceling.Value())
fmt.Println(result.Data[0].CancellationReason)
fmt.Println(result.Data[0].DaysCanceled.Value())
fmt.Println(result.Data[0].Quantity.Value())
Get subscribers reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewSubscribersReportsFilter()
filter.SubTypeDetailed().Version12().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetSubscribersReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].EventDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].AppName)
fmt.Println(result.Data[0].AppAppleID.Value())
fmt.Println(result.Data[0].SubscriptionName)
fmt.Println(result.Data[0].SubscriptionAppleID.Value())
fmt.Println(result.Data[0].SubscriptionGroupID.Value())
fmt.Println(result.Data[0].StandardSubscriptionDuration)
fmt.Println(result.Data[0].PromotionalOfferName)
fmt.Println(result.Data[0].PromotionalOfferID)
fmt.Println(result.Data[0].SubscriptionOfferType)
fmt.Println(result.Data[0].SubscriptionOfferDuration)
fmt.Println(result.Data[0].MarketingOptInDuration)
fmt.Println(result.Data[0].CustomerPrice.Value())
fmt.Println(result.Data[0].CustomerCurrency)
fmt.Println(result.Data[0].DeveloperProceeds.Value())
fmt.Println(result.Data[0].ProceedsCurrency)
fmt.Println(result.Data[0].PreservedPricing)
fmt.Println(result.Data[0].ProceedsReason)
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].Country)
fmt.Println(result.Data[0].SubscriberID.Value())
fmt.Println(result.Data[0].SubscriberIDReset)
fmt.Println(result.Data[0].Refund)
fmt.Println(result.Data[0].PurchaseDate.Value())
fmt.Println(result.Data[0].Units.Value())
Get preorders reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewPreOrdersReportsFilter()
filter.SubTypeSummary().Version10().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetPreOrdersReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].Provider)
fmt.Println(result.Data[0].ProviderCountry)
fmt.Println(result.Data[0].Title)
fmt.Println(result.Data[0].SKU)
fmt.Println(result.Data[0].Developer)
fmt.Println(result.Data[0].PreOrderStartDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].PreOrderEndDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].Ordered.Value())
fmt.Println(result.Data[0].Canceled.Value())
fmt.Println(result.Data[0].CumulativeOrdered.Value())
fmt.Println(result.Data[0].CumulativeCanceled.Value())
fmt.Println(result.Data[0].StartDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].EndDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].CountryCode)
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].Category)
fmt.Println(result.Data[0].Device)
fmt.Println(result.Data[0].SupportedPlatforms)
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].ProviderCountry)
Get financial reports
ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter :=  appstore_sdk.NewFinancesReportsFilter()
filter.SetReportDate(date).SetRegionCode("US")

result, resp, err := client.FinancesReports().GetFinancialReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].StartDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].EndDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].UPC)
fmt.Println(result.Data[0].ISRCIsbn)
fmt.Println(result.Data[0].VendorIdentifier)
fmt.Println(result.Data[0].Quantity.Value())
fmt.Println(result.Data[0].PartnerShare.Value())
fmt.Println(result.Data[0].ExtendedPartnerShare.Value())
fmt.Println(result.Data[0].PartnerShareCurrency)
fmt.Println(result.Data[0].SaleOrReturn)
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].ArtistShowDeveloperAuthor)
fmt.Println(result.Data[0].Title)
fmt.Println(result.Data[0].LabelStudioNetworkDeveloperPublisher)
fmt.Println(result.Data[0].Grid)
fmt.Println(result.Data[0].ProductTypeIdentifier)
fmt.Println(result.Data[0].ISANOtherIdentifier)
fmt.Println(result.Data[0].CountryOfSale)
fmt.Println(result.Data[0].PreOrderFlag)
fmt.Println(result.Data[0].PromoCode)
fmt.Println(result.Data[0].CustomerPrice.Value())
fmt.Println(result.Data[0].CustomerCurrency)

Documentation

Index

Constants

View Source
const AppStoreConnectAPIAudience = "appstoreconnect-v1"

AppStoreConnectAPIAudience const

View Source
const AppStoreConnectAPIHttpIdleConnectionTimeout = 30 * time.Second

AppStoreConnectAPIHttpIdleConnectionTimeout const

View Source
const AppStoreConnectAPIHttpMaxIdleConnection = 10

AppStoreConnectAPIHttpMaxIdleConnection const

View Source
const AppStoreConnectAPIProductionUri = "https://api.appstoreconnect.apple.com"

AppStoreConnectAPIProductionUri const

View Source
const AppStoreConnectAPITokenTtl = 600

AppStoreConnectAPITokenTtl const

View Source
const CustomDateFormatDefault = "2006-01-02"

CustomDateFormatDefault const

View Source
const CustomDateFormatSlash = "01/02/2006"

CustomDateFormatSlash const

View Source
const CustomTimestampFormatDefault = "2006-01-02 15:04:05"

CustomTimestampFormatDefault const

View Source
const ResponseContentTypeGzip = "application/a-gzip"
View Source
const ResponseContentTypeJson = "application/json; charset=utf-8"

Variables

This section is empty.

Functions

func NewCSVReader added in v1.0.4

func NewCSVReader(in io.Reader) gocsv.CSVReader

NewCSVReader Create new CSV reader for unmarshaler

func NewDefaultHttpClient

func NewDefaultHttpClient() *http.Client

NewDefaultHttpClient create new http client

func NewLineSkipDecoder added in v1.0.4

func NewLineSkipDecoder(r io.Reader) (gocsv.SimpleDecoder, error)

NewLineSkipDecoder

func UnmarshalCSV added in v1.0.4

func UnmarshalCSV(in []byte, out interface{}) error

UnmarshalCSV unmarshal raw data to structures

func UnmarshalCSVWithFilterLines added in v1.0.4

func UnmarshalCSVWithFilterLines(in []byte, out interface{}) error

UnmarshalCSVWithFilterLines unmarshal raw data to structures with filter lines

Types

type AuthToken

type AuthToken struct {
	Token     string
	ExpiresAt int64
}

AuthToken auth token structure

func (*AuthToken) IsNotExpired

func (t *AuthToken) IsNotExpired() bool

IsNotExpired Check token is not expired

func (*AuthToken) IsValid

func (t *AuthToken) IsValid() bool

IsValid Check token is valid

type Client

type Client struct {
	Cfg *Config
	// contains filtered or unexported fields
}

Client common

func NewClientFromConfig

func NewClientFromConfig(cfg *Config, cl *http.Client) *Client

NewClientFromConfig Create new client from config

func (*Client) FinancesReports added in v1.0.4

func (cl *Client) FinancesReports() *FinancesReportsResource

FinancesReports resource

func (*Client) Init

func (cl *Client) Init() error

Init of client

func (*Client) SalesReports

func (cl *Client) SalesReports() *SalesReportsResource

SalesReports resource

type Config

type Config struct {
	Uri        string
	VendorNo   string
	IssuerId   string
	KeyId      string
	PrivateKey string
	Token      *TokenConfig
}

Config structure

func NewConfig

func NewConfig(issuerId string, keyId string, vendorNo string, pkPathOrContent string) *Config

NewConfig Create new config from credentials

type CustomBoolean

type CustomBoolean struct {
	Boolean bool
}

CustomBoolean Custom boolean type

func (*CustomBoolean) MarshalJSON

func (cb *CustomBoolean) MarshalJSON() ([]byte, error)

MarshalJSON Custom boolean MarshalJSON

func (*CustomBoolean) UnmarshalCSV

func (cb *CustomBoolean) UnmarshalCSV(csv string) error

UnmarshalCSV Custom boolean UnmarshalCSV

func (*CustomBoolean) Value

func (cb *CustomBoolean) Value() bool

Value Custom boolean get value

type CustomDate

type CustomDate struct {
	Date time.Time
}

CustomDate Custom date type

func (*CustomDate) MarshalJSON

func (ct *CustomDate) MarshalJSON() ([]byte, error)

MarshalJSON Custom date MarshalJSON

func (*CustomDate) UnmarshalCSV

func (ct *CustomDate) UnmarshalCSV(csv string) error

UnmarshalCSV Custom date UnmarshalCSV

func (*CustomDate) Value

func (ct *CustomDate) Value() time.Time

Value Custom date get value

type CustomFloat64

type CustomFloat64 struct {
	Float64 float64
}

CustomFloat64 custom float type

func (*CustomFloat64) MarshalJSON

func (cf *CustomFloat64) MarshalJSON() ([]byte, error)

MarshalJSON Custom float MarshalJSON

func (*CustomFloat64) UnmarshalCSV

func (cf *CustomFloat64) UnmarshalCSV(csv string) error

UnmarshalCSV Custom float UnmarshalCSV

func (*CustomFloat64) Value

func (cf *CustomFloat64) Value() float64

Value Custom float get value

type CustomInteger

type CustomInteger struct {
	Integer int
}

CustomInteger custom integer type

func (*CustomInteger) MarshalJSON

func (ci *CustomInteger) MarshalJSON() ([]byte, error)

MarshalJSON Custom integer MarshalJSON

func (*CustomInteger) UnmarshalCSV

func (ci *CustomInteger) UnmarshalCSV(csv string) error

UnmarshalCSV Custom integer UnmarshalCSV

func (*CustomInteger) Value

func (ci *CustomInteger) Value() int

Value Custom integer get value

type CustomTimestamp

type CustomTimestamp struct {
	Timestamp time.Time
}

CustomTimestamp custom timestamp type

func (*CustomTimestamp) MarshalJSON

func (ct *CustomTimestamp) MarshalJSON() ([]byte, error)

MarshalJSON Custom timestamp MarshalJSON

func (*CustomTimestamp) UnmarshalCSV

func (ct *CustomTimestamp) UnmarshalCSV(csv string) error

UnmarshalCSV Custom timestamp UnmarshalCSV

func (*CustomTimestamp) Value

func (ct *CustomTimestamp) Value() time.Time

Value Custom timestamp get value

type Error

type Error struct {
	Id     string       `json:"id"`     //(Required) A machine-readable code indicating the type of error. The code is a hierarchical value with levels of specificity separated by the '.' character. This value is parseable for programmatic error handling in code.
	Status string       `json:"status"` //(Required) The HTTP status code of the error. This status code usually matches the response's status code; however, if the request produces multiple errors, these two codes may differ.
	Code   string       `json:"code"`   //The unique ID of a specific instance of an error, request, and response. Use this ID when providing feedback to or debugging issues with Apple.
	Title  string       `json:"title"`  //(Required) A summary of the error. Do not use this field for programmatic error handling.
	Detail string       `json:"detail"` //(Required) A detailed explanation of the error. Do not use this field for programmatic error handling.
	Source *ErrorSource `json:"source"` //One of two possible types of values: source.parameter, provided when a query parameter produced the error, or source.JsonPointer, provided when a problem with the entity produced the error.
}

Error The details about one error that is returned when an API request is not successful. .see https://developer.apple.com/documentation/appstoreconnectapi/errorresponse/errors

type ErrorSource

type ErrorSource struct {
	Parameter string `json:"parameter"` //The query parameter that produced the error.
	Pointer   string `json:"pointer"`   //A JSON pointer that indicates the location in the request entity where the error originates
}

ErrorSource An object that contains the query parameter that produced the error. An object that contains the JSON pointer that indicates the location of the error.

type FinancesReportType added in v1.0.4

type FinancesReportType string

FinancesReportType type

const (
	//FinancesReportTypeFinancial const
	FinancesReportTypeFinancial FinancesReportType = "FINANCIAL"
	//FinancesReportTypeFinanceDetail const
	FinancesReportTypeFinanceDetail FinancesReportType = "FINANCE_DETAIL"
)

type FinancesReportsFilter added in v1.0.4

type FinancesReportsFilter struct {
	ReportDate time.Time          //(Required) The fiscal month of the report you wish to download based on the Apple Fiscal Calendar. The fiscal month is specified in the YYYY-MM format.
	ReportType FinancesReportType //(Required) This value is always FINANCIAL. Possible values: FINANCIAL, FINANCE_DETAIL
	RegionCode string             //(Required) You can download consolidated or separate financial reports per territory. For a complete list of possible values, see Financial Report Regions and Currencies.
}

FinancesReportsFilter sales reports filter

func NewFinancesReportsFilter added in v1.0.4

func NewFinancesReportsFilter() *FinancesReportsFilter

func (*FinancesReportsFilter) IsValid added in v1.0.4

func (f *FinancesReportsFilter) IsValid() error

IsValid Validate sales report filter params

func (*FinancesReportsFilter) SetRegionCode added in v1.0.4

func (f *FinancesReportsFilter) SetRegionCode(value string) *FinancesReportsFilter

SetRegionCode Set report date

func (*FinancesReportsFilter) SetReportDate added in v1.0.4

func (f *FinancesReportsFilter) SetReportDate(value time.Time) *FinancesReportsFilter

SetReportDate Set report date

func (*FinancesReportsFilter) SetReportType added in v1.0.4

SetReportType Set report type

func (*FinancesReportsFilter) TypeFinanceDetail added in v1.0.4

func (f *FinancesReportsFilter) TypeFinanceDetail() *FinancesReportsFilter

TypeFinanceDetail Change report type to Sales

func (*FinancesReportsFilter) TypeFinancial added in v1.0.4

func (f *FinancesReportsFilter) TypeFinancial() *FinancesReportsFilter

TypeFinancial Change report type to Financial

type FinancesReportsResource added in v1.0.4

type FinancesReportsResource struct {
	ResourceAbstract
}

FinancesReportsResource reports

func (*FinancesReportsResource) GetFinancialReports added in v1.0.4

GetFinancialReports

func (*FinancesReportsResource) GetReports added in v1.0.4

GetReports Get finances reports by filter

type FinancialReport added in v1.0.4

type FinancialReport struct {
	StartDate                            CustomDate    `csv:"Start Date" json:"start_date"`                                                                     //This is the period start date, based on Apple’s fiscal calendar.
	EndDate                              CustomDate    `csv:"End Date" json:"end_date"`                                                                         //This is the period end date, also based on Apple’s fiscal calendar.
	UPC                                  string        `csv:"UPC" json:"upc"`                                                                                   //This field is not applicable to developers. This will display as blank.
	ISRCIsbn                             string        `csv:"ISRC / ISBN" json:"isrc_isbn"`                                                                     //For apps, this is your SKU. For details, see App information. For in app purchases, this is the product ID. See In-app purchase information for details.
	VendorIdentifier                     string        `csv:"Vendor Identifier" json:"vendor_identifier"`                                                       //This is the “SKU” that was provided for an app, or a “Product ID” provided for an in-app purchase.
	Quantity                             CustomInteger `csv:"Quantity" json:"quantity"`                                                                         //Aggregated number of units sold.
	PartnerShare                         CustomFloat64 `csv:"Partner Share" json:"partner_share"`                                                               //The proceeds you receive per unit. This is the Customer Price minus applicable taxes and Apple’s commission, per Schedule 2 of your Paid Applications agreement.
	ExtendedPartnerShare                 CustomFloat64 `csv:"Extended Partner Share" json:"extended_partner_share"`                                             //Quantity multiplied by Partner Share.
	PartnerShareCurrency                 string        `csv:"Partner Share Currency" json:"partner_share_currency"`                                             //Three-character ISO code for the currency of the amounts earned.
	SaleOrReturn                         string        `csv:"Sales or Return" json:"sales_or_return"`                                                           //S indicates a Sale, R indicates a Return
	AppleIdentifier                      CustomInteger `csv:"Apple Identifier" json:"apple_identifier"`                                                         //Apple ID, a unique identifier automatically generated for your app when you add the app to your account. You can view this property in the App Information section in App Store Connect. This identifier is also used in the URL for the App Store on desktop computers. You can’t edit this property.
	ArtistShowDeveloperAuthor            string        `csv:"Artist / Show / Developer / Author" json:"artist_show_developer_author"`                           //Your legal entity name.
	Title                                string        `csv:"Title" json:"title"`                                                                               //The name you entered for your app as described in App information.
	LabelStudioNetworkDeveloperPublisher string        `csv:"Label / Studio / Network / Developer / Publisher" json:"label_studio_network_developer_publisher"` //This field is not applicable to developers. This will display as blank.
	Grid                                 string        `csv:"Grid" json:"grid"`                                                                                 //This field is not applicable to developers. This will display as blank.
	ProductTypeIdentifier                string        `csv:"Product Type Identifier" json:"product_type_identifier"`                                           //The type of product purchased. See Product Type Identifiers for more information.
	ISANOtherIdentifier                  string        `csv:"ISAN / Other Identifier" json:"isan_other_identifier"`                                             //This field is not applicable to developers. This will display as blank.
	CountryOfSale                        string        `csv:"Country Of Sale" json:"country_of_sale"`                                                           //Two-character ISO code (such as US for the United States) that indicates the country or region for the App Store where the purchase occurred. This is based on the customer Apple ID country or region.
	PreOrderFlag                         string        `csv:"Pre-order Flag" json:"preorder_flag"`                                                              //“P” or null
	PromoCode                            string        `csv:"Promo Code" json:"promo_code"`                                                                     //If the transaction was part of a promotion, a gift, or was downloaded through the Volume Purchase Program for Education, this field will contain a value. This field is empty for all non-promotional items. For more information, see Promotional Codes.
	CustomerPrice                        CustomFloat64 `csv:"Customer Price" json:"customer_price"`                                                             //The price per unit billed to the customer, which you set for your app or in-app purchase in App Store Connect. *Customer price is inclusive of any applicable taxes we collect and remit per Schedule 2 of the Paid Applications agreement.
	CustomerCurrency                     string        `csv:"Customer Currency" json:"customer_currency"`                                                       //Three-character ISO code for the currency type paid by the customer. For example, USD for United States Dollar.
}

FinancialReport

type FinancialReportsResponse added in v1.0.4

type FinancialReportsResponse struct {
	ResponseBody
	Data []*FinancialReport `json:"data,omitempty"`
}

FinancialReportsResponse struct

type NewsstandReportsFilter added in v1.0.4

type NewsstandReportsFilter struct {
	SalesReportsBaseFilter
}

NewsstandReportsFilter

func NewNewsstandReportsFilter added in v1.0.4

func NewNewsstandReportsFilter() *NewsstandReportsFilter

NewNewsstandReportsFilter

func (*NewsstandReportsFilter) IsValid added in v1.0.4

func (f *NewsstandReportsFilter) IsValid() error

IsValid Validate sales report filter params

type PreOrdersReport added in v1.0.4

type PreOrdersReport struct {
	Provider           string        `csv:"Provider" json:"provider"`                        //Service provider in your reports (typically Apple).
	ProviderCountry    string        `csv:"Provider Country" json:"provider_country"`        //Service provider country code (typically U.S.).
	SKU                string        `csv:"SKU" json:"sku"`                                  //Product identifier provided by you during app setup.
	Developer          string        `csv:"Developer" json:"developer"`                      //Provided by you during the initial account setup.
	Title              string        `csv:"Title" json:"title"`                              //Provided by you during app setup.
	PreOrderStartDate  CustomDate    `csv:"Pre-Order Start Date" json:"preorder_start_date"` //Date the app becomes available for pre-order.
	PreOrderEndDate    CustomDate    `csv:"Pre-Order End Date" json:"preorder_end_date"`     //Last date the app is available for pre-order, after which the app is available for sale.
	Ordered            CustomFloat64 `csv:"Ordered" json:"ordered"`                          //Aggregated number of pre-orders for the period.
	Canceled           CustomFloat64 `csv:"Canceled" json:"canceled"`                        //Aggregated number of canceled pre-orders for the period.
	CumulativeOrdered  CustomFloat64 `csv:"Cumulative Ordered" json:"cumulative_ordered"`    //Total number of pre-orders since the start of the pre-order period.
	CumulativeCanceled CustomFloat64 `csv:"Cumulative Canceled" json:"cumulative_canceled"`  //Total number of canceled pre-orders since the start of the pre-order period.
	StartDate          CustomDate    `csv:"Start Date" json:"start_date"`                    //Start date of report.
	EndDate            CustomDate    `csv:"End Date" json:"end_date"`                        //End date of report.
	CountryCode        string        `csv:"Country Code" json:"country_code"`                //Two-character ISO country code indicating the App Store territory of the Pre-Order. For more information, see Financial Report Regions and Currencies.
	AppleIdentifier    CustomInteger `csv:"Apple Identifier" json:"apple_identifier"`        //Apple ID for your app.
	Device             string        `csv:"Device" json:"device"`                            //Type of device used for purchase: iPhone, iPad, Apple TV, iPod touch, or Desktop.
	SupportedPlatforms string        `csv:"Supported Platforms" json:"supported_platforms"`  //List of platforms that your app supports: iOS, tvOS, iOS and tvOS, or macOS.
	Category           string        `csv:"Category" json:"category"`                        //Indicates the category of the app, such as Games.
	Client             string        `csv:"Client" json:"client"`                            //Indicates where the purchase happened: App Store, App Store for iMessage, or blank.
}

PreOrdersReport Aggregated data for your apps made available for pre-order, including the number of units ordered and canceled by customers.

type PreOrdersReportsFilter added in v1.0.4

type PreOrdersReportsFilter struct {
	SalesReportsBaseFilter
}

PreOrdersReportsFilter

func NewPreOrdersReportsFilter added in v1.0.4

func NewPreOrdersReportsFilter() *PreOrdersReportsFilter

NewPreOrdersReportsFilter

func (*PreOrdersReportsFilter) IsValid added in v1.0.4

func (f *PreOrdersReportsFilter) IsValid() error

IsValid Validate sales report filter params

type PreOrdersReportsResponse added in v1.0.4

type PreOrdersReportsResponse struct {
	ResponseBody
	Data []*PreOrdersReport `json:"data,omitempty"`
}

PreOrdersReportsResponse struct

type PrivateKey

type PrivateKey struct {
}

PrivateKey private key handler

func (*PrivateKey) DecodePem

func (pk *PrivateKey) DecodePem(rawBytes []byte) (*pem.Block, error)

DecodePem Decode private key pem

func (*PrivateKey) Load

func (pk *PrivateKey) Load(path string) (*ecdsa.PrivateKey, error)

Load and generate private key

func (*PrivateKey) LoadData

func (pk *PrivateKey) LoadData(pathOrContent string) ([]byte, error)

LoadData Load private key from string or file path

func (*PrivateKey) LoadFromContent

func (pk *PrivateKey) LoadFromContent(content string) ([]byte, error)

LoadFromContent Load private key from string

func (*PrivateKey) LoadFromFile

func (pk *PrivateKey) LoadFromFile(path string) ([]byte, error)

LoadFromFile Load private key from file

func (*PrivateKey) ParseP8

func (pk *PrivateKey) ParseP8(rawBytes []byte) (*ecdsa.PrivateKey, error)

ParseP8 Parse private key .p8

func (*PrivateKey) ParsePKCS8

func (pk *PrivateKey) ParsePKCS8(rawBytes []byte) (*ecdsa.PrivateKey, error)

ParsePKCS8 Parse PKCS private key .p8

type RequestBuilder

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

RequestBuilder handler

func (*RequestBuilder) BuildRequest added in v1.0.4

func (rb *RequestBuilder) BuildRequest(ctx context.Context, method string, path string, query map[string]interface{}, body map[string]interface{}) (req *http.Request, err error)

BuildRequest method

type ResourceAbstract

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

ResourceAbstract base resource

type ResponseBody added in v1.0.4

type ResponseBody struct {

	//ErrorResult Information with error details that an API returns in the response body whenever the API request is not successful.
	// .see https://developer.apple.com/documentation/appstoreconnectapi/errorresponse
	Errors []*Error `json:"errors,omitempty"`
	// contains filtered or unexported fields
}

ResponseBody struct

func (*ResponseBody) GetError added in v1.0.4

func (r *ResponseBody) GetError() string

GetError method

func (*ResponseBody) IsSuccess added in v1.0.4

func (r *ResponseBody) IsSuccess() bool

IsSuccess method

type ResponseHandlerGzip added in v1.0.4

type ResponseHandlerGzip struct {
	FilterLines bool
}

func (*ResponseHandlerGzip) ReadBody added in v1.0.4

func (r *ResponseHandlerGzip) ReadBody(resp *http.Response) ([]byte, error)

func (*ResponseHandlerGzip) RestoreBody added in v1.0.4

func (r *ResponseHandlerGzip) RestoreBody(data []byte) (io.ReadCloser, error)

func (*ResponseHandlerGzip) UnmarshalBody added in v1.0.4

func (r *ResponseHandlerGzip) UnmarshalBody(data []byte, v interface{}) error

type ResponseHandlerInterface added in v1.0.4

type ResponseHandlerInterface interface {
	ReadBody(resp *http.Response) ([]byte, error)
	UnmarshalBody(data []byte, v interface{}) error
	RestoreBody(data []byte) (io.ReadCloser, error)
}

func NewResponseHandler added in v1.0.4

func NewResponseHandler(contentType string, filterLines bool) ResponseHandlerInterface

type ResponseHandlerJson added in v1.0.4

type ResponseHandlerJson struct {
}

func (*ResponseHandlerJson) ReadBody added in v1.0.4

func (r *ResponseHandlerJson) ReadBody(resp *http.Response) ([]byte, error)

func (*ResponseHandlerJson) RestoreBody added in v1.0.4

func (r *ResponseHandlerJson) RestoreBody(data []byte) (io.ReadCloser, error)

func (*ResponseHandlerJson) UnmarshalBody added in v1.0.4

func (r *ResponseHandlerJson) UnmarshalBody(data []byte, v interface{}) error

type SalesReport added in v1.0.4

type SalesReport struct {
	Provider              string        `csv:"Provider" json:"provider"`                               //The service provider in your reports (typically Apple).
	ProviderCountry       string        `csv:"Provider Country" json:"provider_country"`               //The service provider country code (typically U.S.).
	SKU                   string        `csv:"SKU" json:"sku"`                                         //A product identifier provided by you during app setup.
	Developer             string        `csv:"Developer" json:"developer"`                             //Provided by you during the initial account setup.
	Name                  string        `csv:"Name" json:"name"`                                       //Provided by you during app setup.
	Title                 string        `csv:"Title" json:"title"`                                     //Provided by you during app setup.
	Version               string        `csv:"SalesReportVersion" json:"version"`                      //Provided by you during app setup.
	ProductTypeIdentifier string        `csv:"Product Type Identifier" json:"product_type_identifier"` //Defines the type of transaction (for example, initial download, update, and so on). For more information, see Product Type Identifiers.
	Units                 CustomFloat64 `csv:"Units" json:"units"`                                     //The aggregated number of units. Negative values indicate refunds, or CMB credits for previously purchased apps when CMB column shows ‘CMB-C’.
	DeveloperProceeds     CustomFloat64 `csv:"Developer Proceeds" json:"developer_proceeds"`           //The amount you receive per unit. This is the Customer Price minus applicable taxes and Apple’s commission, per Schedule 2 of your Paid Applications agreement.
	BeginDate             CustomDate    `csv:"Begin Date" json:"begin_date"`                           //Start date of report.
	EndDate               CustomDate    `csv:"End Date" json:"end_date"`                               //End date of report.
	CustomerCurrency      string        `csv:"Customer Currency" json:"customer_currency"`             //Three-character ISO code indicating the customer’s currency. For more information, see Currency codes.
	CountryCode           string        `csv:"Country Code" json:"country_code"`                       //Two-character ISO country code indicating the App Store territory for the purchase. For more information, see Financial Report Regions and Currencies.
	CurrencyOfProceeds    string        `csv:"Currency of Proceeds" json:"currency_of_proceeds"`       //The currency in which your proceeds are earned. For more information, see Currency codes.
	AppleIdentifier       CustomInteger `csv:"Apple Identifier" json:"apple_identifier"`               //The Apple ID for your app.
	CustomerPrice         CustomFloat64 `csv:"Customer Price" json:"customer_price"`                   //The price per unit billed to the customer, which you set for your app or in-app purchase in App Store Connect. *Customer price is inclusive of any applicable taxes we collect and remit per Schedule 2 of the Paid Applications agreement. Negative values indicate refunds, or CMB credits for previously purchased apps when CMB column shows ‘CMB-C’.
	PromoCode             string        `csv:"Promo Code" json:"promo_code"`                           //If the transaction was part of a promotion, this field will contain a value. This field is empty for all non-promotional items. For more information, see Promotional Codes.
	ParentIdentifier      string        `csv:"Parent Identifier" json:"parent_identifier"`             //In-App Purchases will show the SKU of the associated app.
	Subscription          string        `csv:"Subscription" json:"subscription"`                       //Defines whether an auto-renewable subscription is new or a renewal.
	Period                string        `csv:"Period" json:"period"`                                   //Defines the duration of an auto-renewable subscription purchase. Values include: 7 days, 1 month, 2 months, 3 months, 6 months, and 1 year.
	Category              string        `csv:"Category" json:"category"`                               //Indicates the category of the app, such as Games.
	CMB                   string        `csv:"CMB" json:"cmb"`                                         //If the transaction involves a “completed” app bundle, this field will contain a value of “CMB.” App credits for completed bundles will show a value of “CMB-C.” Otherwise this field is blank.
	Device                string        `csv:"Device" json:"device"`                                   //List of platforms that your app supports: iOS, tvOS, iOS and tvOS, or macOS.
	SupportedPlatforms    string        `csv:"Supported Platforms" json:"supported_platforms"`         // Type of device used for purchase or redownload: iPhone, iPad, Apple TV, iPod touch, or Desktop.
	ProceedsReason        string        `csv:"Proceeds Reason" json:"proceeds_reason"`                 //For Renew events, if the price is preserved then this field equals “Yes”. Otherwise it is blank.
	PreservedPricing      string        `csv:"Preserved Pricing" json:"preserved_pricing"`             //If a subscription has been active for more than a year then you receive 85% of the customer price, minus applicable taxes, and this field equals “Rate After One Year." Otherwise, you receive 70% and the field is blank.
	Client                string        `csv:"Client" json:"client"`                                   //Indicates where the purchase happened: App Store for iMessage, News, or blank.
	OrderType             string        `csv:"Order Type" json:"order_type"`                           //For introductory offers or subscription offers, indicates what type of transaction this line item is: Pay Up Front or Pay As You Go. For pre-orders, indicates whether a purchase originated from a Pre-Order. For promotional offers, the field will populate the Order ID.
}

SalesReport Aggregated sales and download data for your apps and In-App Purchases

type SalesReportFrequency

type SalesReportFrequency string

SalesReportFrequency type

const (
	//SalesReportFrequencyDaily const
	SalesReportFrequencyDaily SalesReportFrequency = "DAILY"
	//SalesReportFrequencyWeekly const
	SalesReportFrequencyWeekly SalesReportFrequency = "WEEKLY"
	//SalesReportFrequencyMonthly const
	SalesReportFrequencyMonthly SalesReportFrequency = "MONTHLY"
	//SalesReportFrequencyYearly const
	SalesReportFrequencyYearly SalesReportFrequency = "YEARLY"
)

type SalesReportSubType

type SalesReportSubType string

SalesReportSubType type

const (
	//SalesReportSubTypeSummary const
	SalesReportSubTypeSummary SalesReportSubType = "SUMMARY"
	//SalesReportSubTypeDetailed const
	SalesReportSubTypeDetailed SalesReportSubType = "DETAILED"
	//SalesReportSubTypeOptIn const
	SalesReportSubTypeOptIn SalesReportSubType = "OPT_IN"
)

type SalesReportType

type SalesReportType string

SalesReportType type

const (
	//SalesReportTypeSales const
	SalesReportTypeSales SalesReportType = "SALES"
	//SalesReportTypePreorder const
	SalesReportTypePreorder SalesReportType = "PRE_ORDER"
	//SalesReportTypeNewsStand const
	SalesReportTypeNewsStand SalesReportType = "NEWSSTAND"
	//SalesReportTypeSubscription const
	SalesReportTypeSubscription SalesReportType = "SUBSCRIPTION"
	//SalesReportTypeSubscriptionEvent const
	SalesReportTypeSubscriptionEvent SalesReportType = "SUBSCRIPTION_EVENT"
	//SalesReportTypeSubscriptionOfferCodeRedemption const
	SalesReportTypeSubscriptionOfferCodeRedemption SalesReportType = "SUBSCRIPTION_OFFER_CODE_REDEMPTION"
	//SalesReportTypeSubscriber const
	SalesReportTypeSubscriber SalesReportType = "SUBSCRIBER"
)

type SalesReportVersion

type SalesReportVersion string

SalesReportVersion type

const (
	//SalesReportVersion10 const
	SalesReportVersion10 SalesReportVersion = "1_0"
	//SalesReportVersion11 const
	SalesReportVersion11 SalesReportVersion = "1_1"
	//SalesReportVersion12 const
	SalesReportVersion12 SalesReportVersion = "1_2"
	//SalesReportVersion13 const
	SalesReportVersion13 SalesReportVersion = "1_3"
)

type SalesReportsBaseFilter added in v1.0.4

type SalesReportsBaseFilter struct {
	ReportDate    time.Time            //The report date to download. The date is specified in the YYYY-MM-DD format for all report frequencies except DAILY, which does not require a specified date. For more information, see report availability and storage.
	ReportSubType SalesReportSubType   //(Required) The report sub type to download. For a list of values, see Allowed Values Based on Sales Report Type below. Possible values: SUMMARY, DETAILED, OPT_IN
	ReportType    SalesReportType      //(Required) The report to download. For more details on each report type see About Reports. Possible values: SALES, PRE_ORDER, NEWSSTAND, SUBSCRIPTION, SUBSCRIPTION_EVENT, SUBSCRIBER
	Frequency     SalesReportFrequency //(Required) Frequency of the report to download. For a list of values, see Allowed Values Based on Sales Report Type below. Possible values: DAILY, WEEKLY, MONTHLY, YEARLY
	Version       SalesReportVersion   //The version of the report. For a list of values, see Allowed Values Based on Sales Report Type below.
}

SalesReportsBaseFilter Sales reports filter

func (*SalesReportsBaseFilter) Daily added in v1.0.4

Daily Change frequency to Daily

func (*SalesReportsBaseFilter) IsValid added in v1.0.4

func (f *SalesReportsBaseFilter) IsValid() error

IsValid Validate sales report filter params

func (*SalesReportsBaseFilter) Monthly added in v1.0.4

Monthly Change frequency to Monthly

func (*SalesReportsBaseFilter) SetFrequency added in v1.0.4

SetFrequency Set frequency

func (*SalesReportsBaseFilter) SetReportDate added in v1.0.4

func (f *SalesReportsBaseFilter) SetReportDate(value time.Time) *SalesReportsBaseFilter

SetReportDate Set report date

func (*SalesReportsBaseFilter) SetReportSubType added in v1.0.4

SetReportSubType Set report sub type

func (*SalesReportsBaseFilter) SetReportType added in v1.0.4

SetReportType Set report type

func (*SalesReportsBaseFilter) SetVersion added in v1.0.4

SetVersion Set version

func (*SalesReportsBaseFilter) SubTypeDetailed added in v1.0.4

func (f *SalesReportsBaseFilter) SubTypeDetailed() *SalesReportsBaseFilter

SubTypeDetailed Change report sub type to Detailed

func (*SalesReportsBaseFilter) SubTypeOptIn added in v1.0.4

SubTypeOptIn Change report sub type to OptIn

func (*SalesReportsBaseFilter) SubTypeSummary added in v1.0.4

func (f *SalesReportsBaseFilter) SubTypeSummary() *SalesReportsBaseFilter

SubTypeSummary Change report sub type to Summary

func (*SalesReportsBaseFilter) ToQueryParamsMap added in v1.0.4

func (f *SalesReportsBaseFilter) ToQueryParamsMap() map[string]interface{}

ToQueryParamsMap Convert filter to query params

func (*SalesReportsBaseFilter) TypeNewsStand added in v1.0.4

func (f *SalesReportsBaseFilter) TypeNewsStand() *SalesReportsBaseFilter

TypeNewsStand Change report type to NewsStand

func (*SalesReportsBaseFilter) TypePreOrder added in v1.0.4

TypePreOrder Change report type to PreOrder

func (*SalesReportsBaseFilter) TypeSales added in v1.0.4

TypeSales Change report type to Sales

func (*SalesReportsBaseFilter) TypeSubscriber added in v1.0.4

func (f *SalesReportsBaseFilter) TypeSubscriber() *SalesReportsBaseFilter

TypeSubscriber Change report type to Subscriber

func (*SalesReportsBaseFilter) TypeSubscription added in v1.0.4

func (f *SalesReportsBaseFilter) TypeSubscription() *SalesReportsBaseFilter

TypeSubscription Change report type to Subscription

func (*SalesReportsBaseFilter) TypeSubscriptionEvent added in v1.0.4

func (f *SalesReportsBaseFilter) TypeSubscriptionEvent() *SalesReportsBaseFilter

TypeSubscriptionEvent Change report type to SubscriptionEvent

func (*SalesReportsBaseFilter) Version10 added in v1.0.4

Version10 Change version to 1_0

func (*SalesReportsBaseFilter) Version11 added in v1.0.5

Version11 Change version to 1_1

func (*SalesReportsBaseFilter) Version12 added in v1.0.4

Version12 Change version to 1_2

func (*SalesReportsBaseFilter) Version13 added in v1.0.4

Version13 Change version to 1_3

func (*SalesReportsBaseFilter) Weekly added in v1.0.4

Weekly Change frequency to Weekly

func (*SalesReportsBaseFilter) Yearly added in v1.0.4

Yearly Change frequency to Yearly

type SalesReportsFilter

type SalesReportsFilter struct {
	SalesReportsBaseFilter
}

SalesReportsFilter

func NewSalesReportsFilter added in v1.0.4

func NewSalesReportsFilter() *SalesReportsFilter

NewSalesReportsFilter

func (*SalesReportsFilter) IsValid

func (f *SalesReportsFilter) IsValid() error

IsValid Validate sales report filter params

type SalesReportsFilterInterface added in v1.0.4

type SalesReportsFilterInterface interface {
	IsValid() error
	ToQueryParamsMap() map[string]interface{}
}

SalesReportsFilterInterface

type SalesReportsResource

type SalesReportsResource struct {
	ResourceAbstract
}

SalesReportsResource reports

func (*SalesReportsResource) GetPreOrdersReports added in v1.0.4

GetPreOrdersReports

func (*SalesReportsResource) GetReports added in v1.0.4

GetReports Get sales reports by filter

func (*SalesReportsResource) GetSalesReports added in v1.0.4

GetSalesReports

func (*SalesReportsResource) GetSubscribersReports added in v1.0.4

GetSubscriptionsReports

func (*SalesReportsResource) GetSubscriptionsEventsReports added in v1.0.4

GetSubscriptionsEventsReports

func (*SalesReportsResource) GetSubscriptionsReports added in v1.0.4

GetSubscriptionsReports

type SalesReportsResponse added in v1.0.4

type SalesReportsResponse struct {
	ResponseBody
	Data []*SalesReport `json:"data,omitempty"`
}

SalesReportsResponse struct

type SubscribersReport added in v1.0.4

type SubscribersReport struct {
	EventDate                    CustomDate    `csv:"Event Date" json:"event_date"`                                         //Date the event occurred.
	AppName                      string        `csv:"App Name" json:"app_name"`                                             //Title of your subscription’s parent app.
	AppAppleID                   CustomInteger `csv:"App Apple ID" json:"app_apple_id"`                                     //Apple ID of your subscription’s parent app.
	SubscriptionName             string        `csv:"Subscription Name" json:"subscription_name"`                           //Title of your subscription.
	SubscriptionAppleID          CustomInteger `csv:"Subscription Apple ID" json:"subscription_apple_id"`                   //Apple ID of your subscription.
	SubscriptionGroupID          CustomInteger `csv:"Subscription Group ID" json:"subscription_group_id"`                   //Your subscription’s Group ID (formerly Family ID).
	StandardSubscriptionDuration string        `csv:"Standard Subscription Duration" json:"standard_subscription_duration"` //Duration of the standard subscription: 7 Days, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	SubscriptionOfferName        string        `csv:"Subscription Offer Name" json:"subscription_offer_name"`               //The promotional offer reference name or the offer code reference name used in App Store Connect when setting up the subscription offer.
	PromotionalOfferID           string        `csv:"Promotional Offer ID" json:"promotional_offer_id"`                     //A code that you create for customers to enter and redeem the subscription offer.
	IntroductoryPriceType        string        `csv:"Introductory Price Type" json:"introductory_price_type"`               //Type of introductory price: Pay Up Front, Pay As You Go, or Free Trial
	PromotionalOfferName         string        `csv:"Promotional Offer Name" json:"promotional_offer_name"`                 //The Promotional Offer Reference Name used in App Store Connect when setting up the Offer.
	SubscriptionOfferDuration    string        `csv:"Subscription Offer Duration" json:"subscription_offer_duration"`       //Duration of the introductory price if applicable: For example, 3 Days, 1 Week, 2 Weeks, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	SubscriptionOfferType        string        `csv:"Subscription Offer Type" json:"subscription_offer_type"`               //The promotional offer reference name or the offer code reference name used in App Store Connect when setting up the subscription offer.
	MarketingOptInDuration       string        `csv:"Marketing Opt-In Duration" json:"marketing_opt_in_duration"`           //Duration of the marketing opt-in if applicable: 7 Days, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	CustomerPrice                CustomFloat64 `csv:"Customer Price" json:"customer_price"`                                 //The price of your auto-renewable subscription.
	CustomerCurrency             string        `csv:"Customer Currency" json:"customer_currency"`                           //Three-character ISO code indicating the customer’s currency. For more information, see Currency codes.
	DeveloperProceeds            CustomFloat64 `csv:"Developer Proceeds" json:"developer_proceeds"`                         //The proceeds for each item delivered.
	ProceedsCurrency             string        `csv:"Proceeds Currency" json:"proceeds_currency"`                           //The currency in which your proceeds are earned. For more information, see Currency codes.
	PreservedPricing             string        `csv:"Preserved Pricing" json:"preserved_pricing"`                           //For renewals, if the price is preserved then this field equals “Yes”. Otherwise, it is blank.
	ProceedsReason               string        `csv:"Proceeds Reason" json:"proceeds_reason"`                               //If a subscription has been active for more than a year then you receive 85% of the customer price, minus applicable taxes, and this field equals “Rate After One Year.” Otherwise, you receive 70% and the field is blank.
	Client                       string        `csv:"Client" json:"client"`                                                 //If the subscription was purchased from News then this field equals “News”. Otherwise, it is blank.
	Country                      string        `csv:"Country" json:"country"`                                               //Two-character ISO country code indicating the App Store territory for the purchase. For more information, see Financial Report Regions and Currencies.
	SubscriberID                 CustomInteger `csv:"Subscriber ID" json:"subscriber_id"`                                   //The randomly generated Subscriber ID that is unique to each customer and developer.
	SubscriberIDReset            string        `csv:"Subscriber ID Reset" json:"subscriber_id_reset"`                       //If a customer cancels all of their subscriptions with you and does not resubscribe within 180 days, the Subscriber ID will be deleted. If the same customer resubscribes after 180 days, then we create a new Subscriber ID and this field equals “Yes.” Otherwise, it is blank.Subscriber IDs are reset when an app is transferred to another developer account.
	Refund                       string        `csv:"Refund" json:"refund"`                                                 //For full or partial refunds, this field equals “Yes.” Otherwise, it is blank.
	PurchaseDate                 CustomDate    `csv:"Purchase Date" json:"purchase_date"`                                   //For refunds, the date of the original purchase.
	Units                        CustomInteger `csv:"Units" json:"units"`                                                   //The aggregated number of units.
}

SubscribersReport Transaction-level data about subscriber activity using randomly generated Subscriber IDs.

type SubscribersReportsFilter added in v1.0.4

type SubscribersReportsFilter struct {
	SalesReportsBaseFilter
}

SubscribersReportsFilter

func NewSubscribersReportsFilter added in v1.0.4

func NewSubscribersReportsFilter() *SubscribersReportsFilter

NewSubscribersReportsFilter

func (*SubscribersReportsFilter) IsValid added in v1.0.4

func (f *SubscribersReportsFilter) IsValid() error

IsValid Validate sales report filter params

type SubscribersReportsResponse added in v1.0.4

type SubscribersReportsResponse struct {
	ResponseBody
	Data []*SubscribersReport `json:"data,omitempty"`
}

SubscribersReportsResponse struct

type SubscriptionsEventsReport added in v1.0.4

type SubscriptionsEventsReport struct {
	EventDate                    CustomDate    `csv:"Event Date" json:"event_date"`                                         //Date the event occurred.
	Event                        string        `csv:"Event" json:"event"`                                                   //Type of event that occurred. For more information, see Subscription Events.
	AppName                      string        `csv:"App Name" json:"app_name"`                                             //Title of your subscription’s parent app.
	AppAppleID                   CustomInteger `csv:"App Apple ID" json:"app_apple_id"`                                     //Apple ID of your subscription’s parent app.
	SubscriptionName             string        `csv:"Subscription Name" json:"subscription_name"`                           //Title of your subscription.
	SubscriptionAppleID          CustomInteger `csv:"Subscription Apple ID" json:"subscription_apple_id"`                   //Apple ID of your subscription.
	SubscriptionGroupID          CustomInteger `csv:"Subscription Group ID" json:"subscription_group_id"`                   //Your subscription’s Group ID (formerly Family ID).
	StandardSubscriptionDuration string        `csv:"Standard Subscription Duration" json:"standard_subscription_duration"` //Duration of the standard subscription: 7 Days, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	SubscriptionOfferType        string        `csv:"Subscription Offer Type" json:"subscription_offer_type"`               //Type of introductory price: Pay Up Front, Pay As You Go, or Free Trial
	SubscriptionOfferDuration    string        `csv:"Subscription Offer Duration" json:"subscription_offer_duration"`       //Duration of the introductory price if applicable. For example: 3 Days, 7 Days, 2 Weeks, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	MarketingOptIn               string        `csv:"Marketing Opt-In" json:"marketing_opt_in"`                             //If the subscription included a marketing opt-in then this field equals “Yes”. Otherwise, it is blank.
	MarketingOptInDuration       string        `csv:"Marketing Opt-In Duration" json:"marketing_opt_in_duration"`           //Duration of the opt-in if applicable: 7 Days, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	PreservedPricing             string        `csv:"Preserved Pricing" json:"preserved_pricing"`                           //For Renew events, if the price is preserved then this field equals “Yes”. Otherwise, it is blank.
	ProceedsReason               string        `csv:"Proceeds Reason" json:"proceeds_reason"`                               //For Renew events, if the subscription has been active for more than a year then you receive 85% of the customer price, minus applicable taxes, and this field equals “Rate After One Year”. Otherwise, you receive 70% and the field is blank.
	PromotionalOfferName         string        `csv:"Promotional Offer Name" json:"promotional_offer_name"`                 //The Promotional Offer Reference Name used in App Store Connect when setting up the offer.
	PromotionalOfferID           string        `csv:"Promotional Offer ID" json:"promotional_offer_id"`                     //An identifier that you set for your subscription offers in App Store Connect. For Promotional Offers this is the value entered in the Promotional Offer Reference Name field when setting up the offer. For one-time use offer codes, this is the value entered in the Offer Code Reference Name field when setting up the offer. For custom offer codes this is the code shared with your users.
	ConsecutivePaidPeriods       CustomInteger `csv:"Consecutive Paid Periods" json:"consecutive_paid_periods"`             //The total number of paid periods that the subscription has been active without cancellation. This does not include free trials, marketing opt-in bonus periods, or grace periods.
	OriginalStartDate            CustomDate    `csv:"Original Start Date" json:"original_start_date"`                       //Date of the initial subscription purchase.
	Device                       string        `csv:"Device" json:"device"`                                                 //Type of device used for initial subscription purchase: iPhone, iPad, Apple TV, iPod touch, or Desktop.
	Client                       string        `csv:"Client" json:"client"`                                                 //If the subscription was purchased from News then this field equals “News”. Otherwise, it is blank.
	State                        string        `csv:"State" json:"state"`                                                   //State field in the address submitted by the customer when signing up for their Apple ID. This field is not validated and may be blank.
	Country                      string        `csv:"Country" json:"country"`                                               //Two-character ISO country code indicating the App Store territory for the purchase. For more information, see Financial Report Regions and Currencies
	PreviousSubscriptionName     string        `csv:"Previous Subscription Name" json:"previous_subscription_name"`         //For upgrade, downgrade, and crossgrade events, the title of the previous subscription.
	PreviousSubscriptionAppleID  CustomInteger `csv:"Previous Subscription Apple ID" json:"previous_subscription_apple_id"` //For upgrade, downgrade, and crossgrade events, the Apple ID of the previous subscription.
	DaysBeforeCanceling          CustomInteger `csv:"Days Before Canceling" json:"days_before_canceling"`                   //For cancel events, the number of days from the start date to when a subscriber canceled, which could be in the middle of the period. This only applies to cancel events where cancellation reason equals ‘canceled.' Otherwise, it is blank.
	CancellationReason           string        `csv:"Cancellation Reason" json:"cancellation_reason"`                       //Reason for a cancellation: Billing issue, Price increase, Canceled, Removed from Sale, or Other. For more information, see Cancellation Reasons.
	DaysCanceled                 CustomInteger `csv:"Days Canceled" json:"days_canceled"`                                   //For reactivate events, the number of days ago that the subscriber canceled.
	Quantity                     CustomInteger `csv:"Quantity" json:"quantity"`                                             //Number of events with the same values for the other fields.
}

SubscriptionsEventsReport Aggregated data about subscriber activity, including upgrades, renewals, and introductory price conversions

type SubscriptionsEventsReportsFilter added in v1.0.4

type SubscriptionsEventsReportsFilter struct {
	SalesReportsBaseFilter
}

SubscriptionsEventsReportsFilter

func NewSubscriptionsEventsReportsFilter added in v1.0.4

func NewSubscriptionsEventsReportsFilter() *SubscriptionsEventsReportsFilter

NewSubscriptionsEventsReportsFilter

func (*SubscriptionsEventsReportsFilter) IsValid added in v1.0.4

IsValid Validate sales report filter params

type SubscriptionsEventsReportsResponse added in v1.0.4

type SubscriptionsEventsReportsResponse struct {
	ResponseBody
	Data []*SubscriptionsEventsReport `json:"data,omitempty"`
}

SubscriptionsEventsReportsResponse struct

type SubscriptionsOffersCodesRedemptionReportsFilter added in v1.0.4

type SubscriptionsOffersCodesRedemptionReportsFilter struct {
	SalesReportsBaseFilter
}

SubscriptionsOffersCodesRedemptionReportsFilter

func NewSubscriptionsOffersCodesRedemptionReportsFilter added in v1.0.4

func NewSubscriptionsOffersCodesRedemptionReportsFilter() *SubscriptionsOffersCodesRedemptionReportsFilter

func (*SubscriptionsOffersCodesRedemptionReportsFilter) IsValid added in v1.0.4

IsValid Validate sales report filter params

type SubscriptionsOffersRedemptionReport added in v1.0.4

type SubscriptionsOffersRedemptionReport struct {
	Date                CustomDate    `csv:"Date" json:"date"`                                   //The date the redemptions occurred.
	AppName             string        `csv:"App Name" json:"app_name"`                           //Title of your subscription’s parent app.
	AppAppleID          CustomInteger `csv:"App Apple ID" json:"app_apple_id"`                   //Apple ID of your subscription’s parent app.
	SubscriptionName    string        `csv:"Subscription Name" json:"subscription_name"`         //Title of your subscription.
	SubscriptionAppleID CustomInteger `csv:"Subscription Apple ID" json:"subscription_apple_id"` //Apple ID of your subscription.
	OfferReferenceName  string        `csv:"Offer Reference Name" json:"offer_reference_name"`   //The Offer Reference Name used in App Store Connect when setting up the offer.
	OfferCode           string        `csv:"Offer Code" json:"offer_code"`                       //The custom code you created in App Store Connect. In the case of one-time use code redemptions, this field is blank.
	Territory           string        `csv:"Territory" json:"territory"`                         //Two-character ISO country code indicating the App Store territory.
	Redemptions         CustomInteger `csv:"Redemptions" json:"redemptions"`                     //Number of redemptions
}

SubscriptionsOffersRedemptionReport

type SubscriptionsReport added in v1.0.4

type SubscriptionsReport struct {
	AppName                                        string        `csv:"App Name" json:"app_name"`                                                                                           //Title of your subscription’s parent app.
	AppAppleID                                     CustomInteger `csv:"App Apple ID" json:"app_apple_id"`                                                                                   //Apple ID of your subscription’s parent app.
	SubscriptionName                               string        `csv:"Subscription Name" json:"subscription_name"`                                                                         //Title of your subscription.
	SubscriptionAppleID                            CustomInteger `csv:"Subscription Apple ID" json:"subscription_apple_id"`                                                                 //Apple ID of your subscription.
	SubscriptionGroupID                            CustomInteger `csv:"Subscription Group ID" json:"subscription_group_id"`                                                                 //Your subscription’s Group ID (formerly Family ID).
	StandardSubscriptionDuration                   string        `csv:"Standard Subscription Duration" json:"standard_subscription_duration"`                                               //Duration of the standard subscription: 7 Days, 1 Month, 2 Months, 3 Months, 6 Months, or 1 Year.
	PromotionalOfferName                           string        `csv:"Promotional Offer Name" json:"promotional_offer_name"`                                                               //Retail Price displayed on the App Store and charged to the customer.
	PromotionalOfferID                             string        `csv:"Promotional Offer ID" json:"promotional_offer_id"`                                                                   //Three-character ISO code indicating the customer’s currency. For more information, see Currency codes.
	CustomerPrice                                  CustomFloat64 `csv:"Customer Price" json:"customer_price"`                                                                               //The proceeds for each subscription.
	CustomerCurrency                               string        `csv:"Customer Currency" json:"customer_currency"`                                                                         //The currency in which your proceeds are earned. For more information, see Currency codes.
	DeveloperProceeds                              CustomFloat64 `csv:"Developer Proceeds" json:"developer_proceeds"`                                                                       //For Renew events, if the price is preserved then this field equals “Yes”. Otherwise, it is blank.
	ProceedsCurrency                               string        `csv:"Proceeds Currency" json:"proceeds_currency"`                                                                         //For Renew events, if the subscription has been active for more than a year then you receive 85% of the customer price, minus applicable taxes, and this field equals “Rate After One Year”. Otherwise, you receive 70% and the field is blank.
	PreservedPricing                               string        `csv:"Preserved Pricing" json:"preserved_pricing"`                                                                         //The promotional offer reference name or the offer code reference name used in App Store Connect when setting up the subscription offer.
	ProceedsReason                                 string        `csv:"Proceeds Reason" json:"proceeds_reason"`                                                                             //An identifier that you set for your subscription offers in App Store Connect. For Promotional Offers this is the value entered in the Promotional Offer Reference Name field when setting up the offer. For one-time use offer codes, this is the value entered in the Offer Code Reference Name field when setting up the offer. For custom offer codes this is the code shared with your users.
	Client                                         string        `csv:"Client" json:"client"`                                                                                               //State field in the address submitted by the customer when signing up for their Apple ID. This field is not validated and may be blank.
	Device                                         string        `csv:"Device" json:"device"`                                                                                               //Two-character ISO country code indicating the App Store territory for the purchase. For more information, see Financial Report Regions and Currencies.
	State                                          string        `csv:"State" json:"state"`                                                                                                 //Type of device used for subscription purchase: iPhone, iPad, Apple TV, iPod touch, or Desktop.
	Country                                        string        `csv:"Country" json:"country"`                                                                                             //If the subscription was purchased from News then this field equals “News”. Otherwise, it is blank.
	ActiveStandardPriceSubscriptions               CustomInteger `csv:"Active Standard Price Subscriptions" json:"active_standard_price_subscriptions"`                                     //Total number of auto-renewable standard paid subscriptions currently active, excluding free trials, subscription offers, introductory offers, and marketing opt-ins. Subscriptions are active during the period for which the customer has paid without cancellation.
	ActiveFreeTrialIntroductoryOfferSubscriptions  CustomInteger `csv:"Active Free Trial Introductory Offer Subscriptions" json:"active_free_trial_introductory_offer_subscriptions"`       //Total number of introductory offer subscriptions currently in a free trial.
	ActivePayUpFrontIntroductoryOfferSubscriptions CustomInteger `csv:"Active Pay Up Front Introductory Offer Subscriptions" json:"active_pay_up_front_introductory_offer_subscriptions"`   //Total number of introductory offer subscriptions currently with a pay up front introductory price.
	ActivePayAsYouGoIntroductoryOfferSubscriptions CustomInteger `csv:"Active Pay As You Go Introductory Offer Subscriptions" json:"active_pay_as_you_go_introductory_offer_subscriptions"` //Total number of introductory offer subscriptions currently with a pay as you go introductory price.
	FreeTrialPromotionalOfferSubscriptions         CustomInteger `csv:"Free Trial Promotional Offer Subscriptions" json:"free_trial_promotional_offer_subscriptions"`                       //Total number of promotional offers currently in a free trial.
	PayUpFrontPromotionalOfferSubscriptions        CustomInteger `csv:"Pay Up Front Promotional Offer Subscriptions" json:"pay_up_front_promotional_offer_subscriptions"`                   //Total number of promotional offers with a pay up front promotional price.
	PayAsYouGoPromotionalOfferSubscriptions        CustomInteger `csv:"Pay As You Go Promotional Offer Subscriptions" json:"pay_as_you_go_promotional_offer_subscriptions"`                 //Total number of promotional offers with a pay as you go promotional price.
	MarketingOptIns                                CustomInteger `csv:"Marketing Opt-Ins" json:"marketing_opt_ins"`                                                                         //Total number of subscriptions currently in a marketing opt-in bonus period.
	BillingRetry                                   CustomInteger `csv:"Billing Retry" json:"billing_retry"`                                                                                 //Total number of subscriptions in the Billing Retry status. This indicates that the App Store is still attempting to automatically renew a subscription when billing issues arise (for example, an expired credit card). Available in reports for dates starting December 7, 2017.
	GracePeriod                                    CustomInteger `csv:"Grace Period" json:"grace_period"`                                                                                   //Total number of subscriptions in the Billing Grace Period state. This indicates that subscriber can continue accessing your content for a certain period of time (6 or 16 days) while Apple attempts to correct the billing issue.
	FreeTrialOfferCodeSubscriptions                CustomInteger `csv:"Free Trial Offer Code Subscriptions" json:"free_trial_offer_code_subscriptions"`                                     //Total number of offer code subscriptions currently in a free trial.
	PayUpFrontOfferCodeSubscriptions               CustomInteger `csv:"Pay Up Front Offer Code Subscriptions" json:"pay_up_front_offer_code_subscriptions"`                                 //Total number of offer code subscriptions with a pay up front offer price.
	PayAsYouGoOfferCodeSubscriptions               CustomInteger `csv:"Pay As You Go Offer Code Subscriptions" json:"pay_as_you_go_offer_code_subscriptions"`                               //Total number of offer code subscriptions with a pay as you go offer price.
	Subscribers                                    string        `csv:"Subscribers" json:"subscribers"`                                                                                     //The number of subscribers who have access to the auto-renewable subscription including entitled family members. Note that this field is only populated when the record represents more than 3 subscriptions. Learn more.
}

SubscriptionsReport Total number of Active Subscriptions, Subscriptions with Introductory Prices, and Marketing Opt-Ins for your auto-renewable subscriptions.

type SubscriptionsReportsFilter added in v1.0.4

type SubscriptionsReportsFilter struct {
	SalesReportsBaseFilter
}

SubscriptionsReportsFilter

func NewSubscriptionsReportsFilter added in v1.0.4

func NewSubscriptionsReportsFilter() *SubscriptionsReportsFilter

NewSubscriptionsReportsFilter

func (*SubscriptionsReportsFilter) IsValid added in v1.0.4

func (f *SubscriptionsReportsFilter) IsValid() error

IsValid Validate sales report filter params

type SubscriptionsReportsResponse added in v1.0.4

type SubscriptionsReportsResponse struct {
	ResponseBody
	Data []*SubscriptionsReport `json:"data,omitempty"`
}

SubscriptionsReportsResponse struct

type TokenBuilder

type TokenBuilder struct {
	PrivateKey *PrivateKey
	// contains filtered or unexported fields
}

TokenBuilder token builder

func NewTokenBuilder

func NewTokenBuilder(cfg *Config) *TokenBuilder

NewTokenBuilder Create new TokenBuilder from config

func (*TokenBuilder) BuildAuthToken

func (tb *TokenBuilder) BuildAuthToken() (*AuthToken, error)

BuildAuthToken Build Auth token

func (*TokenBuilder) BuildJWTToken

func (tb *TokenBuilder) BuildJWTToken(payload *jwt.StandardClaims) *jwt.Token

BuildJWTToken Build JWT token

func (*TokenBuilder) BuildPayload

func (tb *TokenBuilder) BuildPayload() *jwt.StandardClaims

BuildPayload Build JWT token payload

type TokenConfig

type TokenConfig struct {
	Audience string
	Type     string
	Algo     string
	Ttl      int
}

TokenConfig token config structure

func NewTokenConfig

func NewTokenConfig() *TokenConfig

NewTokenConfig Create new token config

type Transport

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

Transport wrapper

func NewHttpTransport

func NewHttpTransport(config *Config, token *AuthToken, h *http.Client) *Transport

NewHttpTransport create new http transport

func (*Transport) Get

func (t *Transport) Get(ctx context.Context, path string, query map[string]interface{}) (resp *http.Response, err error)

Get method

func (*Transport) SendRequest added in v1.0.4

func (t *Transport) SendRequest(ctx context.Context, method string, path string, query map[string]interface{}, body map[string]interface{}) (resp *http.Response, err error)

SendRequest method

Jump to

Keyboard shortcuts

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