appbrain

package module
v0.0.0-...-5b36dd9 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: MIT Imports: 21 Imported by: 0

README

Go API client for swagger

API to interact with AppBrain.

Overview

This API client interacts with the AppBrain API.

The client was generated using swagger-codegen and then manually cleaned up and refined to meet code quality standards.

  • API version: 2.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen

Installation

go get the packace and import using the URL of this git repository

import "github.com/liilac/go-appbrain"

Documentation for API Endpoints

All URIs are relative to https://api.appbrain.com/v2

Class Method HTTP request Description
InformationAPI BrowseApps Get /info/browse Apps information
InformationAPI GetApp Get /info/getapp App information
InformationAPI GetCountries Get /info/getcountries Countries information
InformationAPI GetLibraries Get /info/getlibraries Libraries information
InformationAPI SearchApps Get /info/search Apps information
PromotionCampaignsAPI Get Get /campaigns/get Retrieves a promotion campaign
PromotionCampaignsAPI List Get /campaigns/list Lists all promotion campaigns
PromotionCampaignsAPI Update Post /campaigns/update Creates or updates a promotion campaign

Documentation For Models

Documentation For Authorization

apikey

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

Contact Lilac Kapul at lilac@enby.ninja

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	InformationAPI *InformationAPIService

	PromotionCampaignsAPI *PromotionCampaignsAPIService
	// contains filtered or unexported fields
}

APIClient manages communication with the AppBrain API API v2.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath allows switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse defines the structure of a generic response from the AppBrain API

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse is a generator method returning a new instance of *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError is a generator method returning a new instance of *APIResponse for failed API requests not including a regular response

type AppInfo

type AppInfo struct {
	// package
	Pkg string `json:"package,omitempty"`
	// most recent version
	VersionString string `json:"versionString,omitempty"`
	// most recent version code
	VersionCode int32 `json:"versionCode,omitempty"`
	// name of the app
	Name string `json:"name,omitempty"`
	// short one-line description of the app
	ShortDescription string `json:"shortDescription,omitempty"`
	// description of the app
	Description string `json:"description,omitempty"`
	// market category of the app
	MarketCategory string `json:"marketCategory,omitempty"`
	// price of the app
	Price string `json:"price,omitempty"`
	// size of the APK
	ApkSize int64 `json:"apkSize,omitempty"`
	// maturity level of the app
	MaturityLevel string `json:"maturityLevel,omitempty"`
	// minimum supported SDK version
	MinSdkVersion int32 `json:"minSdkVersion,omitempty"`
	// maximum supported SDK version
	MaxSdkVersion int32 `json:"maxSdkVersion,omitempty"`
	// whether the app can be installed on external storage
	SupportsApp2SD string `json:"supportsApp2SD,omitempty"`
	// timestamp of the app's launch in seconds since epoch
	LaunchTime int32 `json:"launchTime,omitempty"`
	// timestamp of the app's latest update in seconds since epoch
	LastAppUpdateTime int32 `json:"lastAppUpdateTime,omitempty"`
	// timestamp of the last refresh of the app information in seconds since epoch
	InfoRefreshTime int32 `json:"infoRefreshTime,omitempty"`
	// Google play category of the number of downloads
	DownloadsCategory string `json:"downloadsCategory,omitempty"`
	// estimated number of downloads
	EstimatedDownloads int64 `json:"estimatedDownloads,omitempty"`
	// estimated number of downloads in the last 30 days
	EstimatedRecentDownloads int64 `json:"estimatedRecentDownloads,omitempty"`
	// average rating
	Rating float64 `json:"rating,omitempty"`
	// average rating in the last 30 days
	RecentRating float64 `json:"recentRating,omitempty"`
	// number of ratings
	RatingCount int32 `json:"ratingCount,omitempty"`
	// number of 1-star ratings
	Rating1StarCount int32 `json:"rating1StarCount,omitempty"`
	// number of 2-star ratings
	Rating2StarCount int32 `json:"rating2StarCount,omitempty"`
	// number of 3-star ratings
	Rating3StarCount int32 `json:"rating3StarCount,omitempty"`
	// number of 4-star ratings
	Rating4StarCount int32 `json:"rating4StarCount,omitempty"`
	// number of 5-star ratings
	Rating5StarCount int32 `json:"rating5StarCount,omitempty"`
	// number of +1s
	PlusOneCount int32 `json:"plusOneCount,omitempty"`
	// number of comments
	CommentCount int32 `json:"commentCount,omitempty"`
	// URL of the app's icon
	IconURL string `json:"iconUrl,omitempty"`
	// URL of the app's feature graphic
	FeatureGraphicURL string `json:"featureGraphicUrl,omitempty"`
	// YouTube URL of the app's promo video
	YouTubeURL string `json:"youtubeUrl,omitempty"`
	// name of the developer of the app
	DeveloperName string `json:"developerName,omitempty"`
	// email address of the developer
	DeveloperEmail string `json:"developerEmail,omitempty"`
	// address of the developer
	DeveloperAddress string `json:"developerAddress,omitempty"`
	// official website of the app
	Website string `json:"website,omitempty"`
	// URLs of the app's screenshots
	ScreenshotUrls []string `json:"screenshotUrls,omitempty"`
	// requested permissions
	Permissions []string `json:"permissions,omitempty"`
	// libraries used in the app
	Libraries []string `json:"libraries,omitempty"`
}

AppInfo describes details of an app from the AppBrain API

type AppInfoList

type AppInfoList struct {
	// List of apps
	Apps []AppInfo `json:"apps,omitempty"`
}

AppInfoList describes a list of apps from the AppBrain API

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

Configuration defines parameters to configure the behaviour of the AppBrain API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration is a generator method returning a new *Configuration instance with the default parameters

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds specified header values as defaults to the AppBrain API client *Configuration struct

type Country

type Country struct {
	// the two-letter ISO country code
	Code string `json:"code,omitempty"`
	// the maximum cost-per-install for a country in dollars
	Cpi float64 `json:"cpi,omitempty"`
}

Country defines the settings for a country in a promotion campaign

type CountryInfo

type CountryInfo struct {
	// country code
	Code string `json:"code,omitempty"`
	// name of the country
	Name string `json:"name,omitempty"`
	// minimum cost-per-install bid for app promotions in this country
	MinCpiBid float64 `json:"minCpiBid,omitempty"`
}

CountryInfo describes a country used in a promotion campaign

type CountryList

type CountryList struct {
	// country information
	Countries []CountryInfo `json:"countries,omitempty"`
}

CountryList describes a list of countries for a promotion campaign

type GenericSwaggerError

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

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type InformationAPIBrowseAppsOpts

type InformationAPIBrowseAppsOpts struct {
	Sort     optional.String
	Filter   optional.String
	Category optional.String
	Offset   optional.Int32
	Limit    optional.Int32
}

InformationAPIBrowseAppsOpts defines the parameters for the BrowseApps() API call

type InformationAPISearchAppsOpts

type InformationAPISearchAppsOpts struct {
	Query    optional.String
	Sort     optional.String
	Filter   optional.String
	Category optional.String
	Offset   optional.Int32
	Limit    optional.Int32
}

InformationAPISearchAppsOpts defines the parameters for the SearchApps call of the InformationAPI

type InformationAPIService

type InformationAPIService service

InformationAPIService groups methods for the AppBrain Information API

func (*InformationAPIService) BrowseApps

BrowseApps returns a list of apps matching the given criteria, including detailed information about each match

func (*InformationAPIService) GetApp

GetApp returns detailed information about a specified app

func (*InformationAPIService) GetCountries

GetCountries returns a list of countries from the *InformationAPI Service

func (*InformationAPIService) GetLibraries

GetLibraries returns a list of known libraries used in apps from the *InformationAPIService

func (*InformationAPIService) SearchApps

SearchApps returns a list of apps fromthe InformationAPIService matching the given parameters

type Library

type Library struct {
	// identifier for the library
	ID string `json:"id,omitempty"`
	// name of the library
	Name string `json:"name,omitempty"`
	// description of the library
	Description string `json:"description,omitempty"`
	// types of the library
	Types []string `json:"types,omitempty"`
	// tags associated with the library
	Tags []string `json:"tags,omitempty"`
	// official URL of the library
	OfficialURL string `json:"officialUrl,omitempty"`
	// AppBrain URL of the library
	AppBrainURL string `json:"appBrainUrl,omitempty"`
}

Library describes a library known to be used in apps

type LibraryList

type LibraryList struct {
	// library information
	Libraries []Library `json:"libraries,omitempty"`
}

LibraryList describes a list of known libraries used in apps

type PromotionCampaign

type PromotionCampaign struct {
	// identifier of the promotion campaign
	Campaign string `json:"campaign,omitempty"`
	// state of the promotion campaign
	State string `json:"state,omitempty"`
	// name/description of the promotion campaign
	Name string `json:"name,omitempty"`
	// promotion title of the promotion campaign
	Title string `json:"title,omitempty"`
	// promotion subtitle of the promotion campaign
	Subtitle string `json:"subtitle,omitempty"`
	// daily budget of the promotion campaign in dollars
	DailyBudget float64 `json:"dailyBudget,omitempty"`
	// total remaining budget the promotion campaign in dollars
	RemainingBudget float64 `json:"remainingBudget,omitempty"`
	// attribution partner that is used for install tracking
	InstallTracking string `json:"installTracking,omitempty"`
	// clickthrough URL of the promotion campaign
	ClickThroughURL string `json:"clickthroughUrl,omitempty"`
	// list of settings for each country where the campaign is running
	Countries []Country `json:"countries,omitempty"`
	// list of publisher subIDs to allow for this campaign
	AllowedSubIds []string `json:"allowedSubIds,omitempty"`
	// list of publisher subIDs to block for this campaign
	BlockedSubIds []string `json:"blockedSubIds,omitempty"`
}

PromotionCampaign describes a promotion campaign on the AppBrain platform

type PromotionCampaignList

type PromotionCampaignList struct {
	// identifiers of existing promotion campaigns
	Campaigns []string `json:"campaigns,omitempty"`
}

PromotionCampaignList describes a list of promotion campaigns

type PromotionCampaignUpdates

type PromotionCampaignUpdates struct {
	// identifier of the promotion campaign (i.e. the package of the promoted app, eventually followed by a dash and an index for multiple campaigns per app.)
	Campaign string `json:"campaign"`
	// state of the promotion campaign
	State string `json:"state,omitempty"`
	// name/description of the promotion campaign
	Name string `json:"name,omitempty"`
	// promotion title of the promotion campaign
	Title string `json:"title,omitempty"`
	// promotion subtitle of the promotion campaign
	Subtitle string `json:"subtitle,omitempty"`
	// daily budget of the promotion campaign in dollars (a negative value indicates no budget limit)
	DailyBudget float64 `json:"dailyBudget,omitempty"`
	// total remaining budget the promotion campaign in dollars (a negative value indicates no budget limit)
	RemainingBudget float64 `json:"remainingBudget,omitempty"`
	// attribution partner that is used for install tracking
	InstallTracking string `json:"installTracking,omitempty"`
	// clickthrough URL of the promotion campaign
	ClickThroughURL string `json:"clickthroughUrl,omitempty"`
	// list of settings for each country where the campaign is running; setting this list overwrites all country settings for the promotion campaign (can't be used simultaneously with updateCountries or removeCountries)
	Countries []Country `json:"countries,omitempty"`
	// updates the provided settings for the countries (can't be used simultaneously with countries)
	UpdateCountries []Country `json:"updateCountries,omitempty"`
	// removes the provided countries from the promotion campaign (can't be used simultaneously with countries)
	RemoveCountries []string `json:"removeCountries,omitempty"`
	// list of publisher subIDs to allow for this campaign; setting this list overwrites all existing allowed subIDs (can't be used simultaneously with addAllowedSubIds)
	AllowedSubIds []string `json:"allowedSubIds,omitempty"`
	// adds publisher subIDs to the list of allowed subIDs (can't be used simultaneously with allowedSubIds)
	AddAllowedSubIds []string `json:"addAllowedSubIds,omitempty"`
	// list of publisher subIDs to block for this campaign; setting this list overwrites all existing blocked subIDs (can't be used simultaneously with addBlockedSubIds)
	BlockedSubIds []string `json:"blockedSubIds,omitempty"`
	// adds publisher subIDs to the list of blocked subIDs (can't be used simultaneously with blockedSubIds)
	AddBlockedSubIds []string `json:"addBlockedSubIds,omitempty"`
}

PromotionCampaignUpdates describes proposed updates for a promotion campaign

type PromotionCampaignsAPIService

type PromotionCampaignsAPIService service

PromotionCampaignsAPIService groups methods relating to the PromotionCampaigns AppBrain API

func (*PromotionCampaignsAPIService) Get

Get returns the details of a promotion campaign

func (*PromotionCampaignsAPIService) List

List returns a list of identifiers for all promotion campaigns

func (*PromotionCampaignsAPIService) Update

Update creates a new promotion campaign or updates an existing one

type PromotionCampaignsAPIUpdateOpts

type PromotionCampaignsAPIUpdateOpts struct {
	Lowbidaction optional.String
}

PromotionCampaignsAPIUpdateOpts defines the parameters for the Update() call to the PromotionCampaigns API

Jump to

Keyboard shortcuts

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