Documentation
¶
Index ¶
- Constants
- func CreateApp(txn gorp.SqlExecutor, s *GoogleService, app *App) error
- func CreateAudit(txn gorp.SqlExecutor, audit *Audit) error
- func CreateBundle(txn gorp.SqlExecutor, bundle *Bundle) error
- func CreateOAuthConfig(config *WebApplicationConfig, tokenCache oauth.Cache) *oauth.Config
- func CreateUser(txn gorp.SqlExecutor, user *User) error
- func GenerateApiDocumentHtml(srcPath string) (string, error)
- func GetServiceAccountToken(config *ServiceAccountConfig) (*oauth.Token, error)
- func IsExistAuthorityForEmail(txn gorp.SqlExecutor, email string) (bool, error)
- func NewToken() string
- func ParseGoogleApiError(apiErr error) (int, string, error)
- func RenderMarkdown(md string) (string, error)
- func Transact(dbm *gorp.DbMap, f func(gorp.SqlExecutor) error) error
- type App
- func (app *App) Authorities(txn gorp.SqlExecutor) ([]*Authority, error)
- func (app *App) Bundles(txn gorp.SqlExecutor) ([]*Bundle, error)
- func (app *App) BundlesByPlatformType(txn gorp.SqlExecutor, platformType BundlePlatformType) ([]*Bundle, error)
- func (app *App) BundlesWithPager(txn gorp.SqlExecutor, page, limit int) (Bundles, int, error)
- func (app *App) CreateAuthority(txn gorp.SqlExecutor, s *GoogleService, authority *Authority) error
- func (app *App) CreateBundle(dbm *gorp.DbMap, s *GoogleService, bundle *Bundle) error
- func (app *App) Delete(txn gorp.SqlExecutor, s *GoogleService) error
- func (app *App) DeleteAuthorities(txn gorp.SqlExecutor) error
- func (app *App) DeleteAuthority(txn gorp.SqlExecutor, s *GoogleService, authority *Authority) error
- func (app *App) DeleteBundles(txn gorp.SqlExecutor) error
- func (app *App) DeleteFromDB(txn gorp.SqlExecutor) error
- func (app *App) DeleteFromGoogleDrive(s *GoogleService) error
- func (app *App) GetMaxRevisionByBundleVersion(txn gorp.SqlExecutor, bundleVersion string) (int, error)
- func (app *App) HasAuthorityForEmail(txn gorp.SqlExecutor, email string) (bool, error)
- func (app *App) ParentReference() *drive.ParentReference
- func (app *App) PreInsert(s gorp.SqlExecutor) error
- func (app *App) PreUpdate(s gorp.SqlExecutor) error
- func (app *App) RefreshToken(txn gorp.SqlExecutor) error
- func (app *App) Save(txn gorp.SqlExecutor) error
- func (app *App) Update(txn gorp.SqlExecutor) error
- type Asset
- type Audit
- func (audit *Audit) Delete(txn gorp.SqlExecutor) error
- func (audit *Audit) PreInsert(s gorp.SqlExecutor) error
- func (audit *Audit) PreUpdate(s gorp.SqlExecutor) error
- func (audit *Audit) Save(txn gorp.SqlExecutor) error
- func (audit *Audit) Update(txn gorp.SqlExecutor) error
- func (audit *Audit) Validate(v *revel.Validation)
- type Authority
- type Bundle
- func (bundle *Bundle) App(txn gorp.SqlExecutor) (*App, error)
- func (bundle *Bundle) BuildFileName() string
- func (bundle *Bundle) Delete(txn gorp.SqlExecutor, s *GoogleService) error
- func (bundle *Bundle) DeleteFromDB(txn gorp.SqlExecutor) error
- func (bundle *Bundle) DeleteFromGoogleDrive(s *GoogleService) error
- func (bundle *Bundle) IsApk() bool
- func (bundle *Bundle) IsIpa() bool
- func (bundle *Bundle) JsonResponse(ub UriBuilder) (*BundleJsonResponse, error)
- func (bundle *Bundle) Plist(txn gorp.SqlExecutor, ipaUrl *url.URL) (*Plist, error)
- func (bundle *Bundle) PlistReader(txn gorp.SqlExecutor, ipaUrl *url.URL) (io.Reader, error)
- func (bundle *Bundle) PreInsert(s gorp.SqlExecutor) error
- func (bundle *Bundle) PreUpdate(s gorp.SqlExecutor) error
- func (bundle *Bundle) Save(txn gorp.SqlExecutor) error
- func (bundle *Bundle) Update(txn gorp.SqlExecutor) error
- type BundleFileExtension
- type BundleInfo
- type BundleJsonResponse
- type BundleParseError
- type BundlePlatformType
- type Bundles
- type BundlesJsonResponse
- type CapacityInfo
- type GoogleService
- func (s *GoogleService) CreateFolder(folderName string) (*drive.File, error)
- func (s *GoogleService) CreateUserPermission(email string, role string) *drive.Permission
- func (s *GoogleService) DeleteAllFiles() error
- func (s *GoogleService) DeleteFile(fileId string) error
- func (s *GoogleService) DeletePermission(fileId string, permissionId string) error
- func (s *GoogleService) DownloadFile(fileId string) (*http.Response, *drive.File, error)
- func (s *GoogleService) GetAbout() (*drive.About, error)
- func (s *GoogleService) GetCapacityInfo() (*CapacityInfo, error)
- func (s *GoogleService) GetFile(fileId string) (*drive.File, error)
- func (s *GoogleService) GetFileList() (*drive.FileList, error)
- func (s *GoogleService) GetPermissionList(fileId string) (*drive.PermissionList, error)
- func (s *GoogleService) GetSharedFileList(ownerEmail string) (*drive.FileList, error)
- func (s *GoogleService) GetTokenInfo() (*oauth2.Tokeninfo, error)
- func (s *GoogleService) GetUserInfo() (*oauth2.Userinfoplus, error)
- func (s *GoogleService) InsertFile(file *os.File, filename string, parent *drive.ParentReference) (*drive.File, error)
- func (s *GoogleService) InsertPermission(fileId string, permission *drive.Permission) (*drive.Permission, error)
- func (s *GoogleService) UpdateFileTitle(fileId string, title string) error
- func (sa *GoogleService) UpdatePermission(fileId string, permissionId string, permission *drive.Permission) (*drive.Permission, error)
- type Item
- type LimitedTimeSignatureInfo
- func (signatureInfo *LimitedTimeSignatureInfo) IsExpired() (bool, error)
- func (signatureInfo *LimitedTimeSignatureInfo) IsValid(key string) (bool, error)
- func (signatureInfo *LimitedTimeSignatureInfo) RefreshSignature(key string)
- func (signatureInfo *LimitedTimeSignatureInfo) UrlValues() *url.Values
- type Metadata
- type ParamToSign
- type Plist
- type ServiceAccountConfig
- type UriBuilder
- type User
- func (user *User) Delete(txn gorp.SqlExecutor) error
- func (user *User) PreInsert(s gorp.SqlExecutor) error
- func (user *User) PreUpdate(s gorp.SqlExecutor) error
- func (user *User) Save(txn gorp.SqlExecutor) error
- func (user *User) Update(txn gorp.SqlExecutor) error
- func (user *User) Validate(v *revel.Validation)
- type WebApplicationConfig
Constants ¶
View Source
const ( ResourceApp int = 1 ResourceBundle int = 2 ResourceAuthority int = 3 )
View Source
const ( ActionCreate int = 1 ActionDelete int = 2 ActionDownload int = 3 )
View Source
const ( PlistFileName = "test.plist" AssetKind = "software-package" DefaultMetadataBundleIdentifier = "com.example.test" MetadataKind = "software" )
View Source
const ( SignatureExpireDuration = 15 * time.Minute SignaturePermittedHttpMethod = "GET" )
Variables ¶
This section is empty.
Functions ¶
func CreateApp ¶
func CreateApp(txn gorp.SqlExecutor, s *GoogleService, app *App) error
func CreateAudit ¶
func CreateAudit(txn gorp.SqlExecutor, audit *Audit) error
func CreateBundle ¶
func CreateBundle(txn gorp.SqlExecutor, bundle *Bundle) error
func CreateOAuthConfig ¶
func CreateOAuthConfig(config *WebApplicationConfig, tokenCache oauth.Cache) *oauth.Config
func CreateUser ¶
func CreateUser(txn gorp.SqlExecutor, user *User) error
func GenerateApiDocumentHtml ¶
func GetServiceAccountToken ¶
func GetServiceAccountToken(config *ServiceAccountConfig) (*oauth.Token, error)
func IsExistAuthorityForEmail ¶
func IsExistAuthorityForEmail(txn gorp.SqlExecutor, email string) (bool, error)
func RenderMarkdown ¶
Types ¶
type App ¶
type App struct { Id int `db:"id"` Title string `db:"title"` FileId string `db:"file_id"` ApiToken string `db:"api_token"` Description string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
https://github.com/coopernurse/gorp#mapping-structs-to-tables
func GetAppByApiToken ¶
func GetAppByApiToken(txn gorp.SqlExecutor, apiToken string) (*App, error)
func (*App) Authorities ¶
func (app *App) Authorities(txn gorp.SqlExecutor) ([]*Authority, error)
func (*App) BundlesByPlatformType ¶
func (app *App) BundlesByPlatformType(txn gorp.SqlExecutor, platformType BundlePlatformType) ([]*Bundle, error)
func (*App) BundlesWithPager ¶
func (*App) CreateAuthority ¶
func (app *App) CreateAuthority(txn gorp.SqlExecutor, s *GoogleService, authority *Authority) error
func (*App) CreateBundle ¶
func (*App) Delete ¶
func (app *App) Delete(txn gorp.SqlExecutor, s *GoogleService) error
func (*App) DeleteAuthorities ¶
func (app *App) DeleteAuthorities(txn gorp.SqlExecutor) error
func (*App) DeleteAuthority ¶
func (app *App) DeleteAuthority(txn gorp.SqlExecutor, s *GoogleService, authority *Authority) error
func (*App) DeleteBundles ¶
func (app *App) DeleteBundles(txn gorp.SqlExecutor) error
func (*App) DeleteFromDB ¶
func (app *App) DeleteFromDB(txn gorp.SqlExecutor) error
func (*App) DeleteFromGoogleDrive ¶
func (app *App) DeleteFromGoogleDrive(s *GoogleService) error
func (*App) GetMaxRevisionByBundleVersion ¶
func (*App) HasAuthorityForEmail ¶
func (*App) ParentReference ¶
func (app *App) ParentReference() *drive.ParentReference
func (*App) RefreshToken ¶
func (app *App) RefreshToken(txn gorp.SqlExecutor) error
type Audit ¶
type Audit struct { Id int `db:"id"` UserId int `db:"user_id"` Resource int `db:"resource"` ResourceId int `db:"resource_id"` Action int `db:"action"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
func (*Audit) Validate ¶
func (audit *Audit) Validate(v *revel.Validation)
type Authority ¶
type Authority struct { Id int `db:"id"` AppId int `db:"app_id"` PermissionId string `db:"permission_id"` Email string `db:"email"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
func GetAuthority ¶
func GetAuthority(txn gorp.SqlExecutor, id int) (*Authority, error)
func (*Authority) DeleteFromDB ¶
func (authority *Authority) DeleteFromDB(txn gorp.SqlExecutor) error
type Bundle ¶
type Bundle struct { Id int `db:"id"` AppId int `db:"app_id"` FileId string `db:"file_id"` PlatformType BundlePlatformType `db:"platform_type"` BundleVersion string `db:"bundle_version"` BundleIdentifier string `db:"bundle_identifier"` Revision int `db:"revision"` Description string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` BundleInfo *BundleInfo `db:"-"` File *os.File `db:"-"` FileName string `db:"-"` }
func GetBundleByFileId ¶
func GetBundleByFileId(txn gorp.SqlExecutor, fileId string) (*Bundle, error)
func (*Bundle) BuildFileName ¶
func (*Bundle) Delete ¶
func (bundle *Bundle) Delete(txn gorp.SqlExecutor, s *GoogleService) error
func (*Bundle) DeleteFromDB ¶
func (bundle *Bundle) DeleteFromDB(txn gorp.SqlExecutor) error
func (*Bundle) DeleteFromGoogleDrive ¶
func (bundle *Bundle) DeleteFromGoogleDrive(s *GoogleService) error
func (*Bundle) JsonResponse ¶
func (bundle *Bundle) JsonResponse(ub UriBuilder) (*BundleJsonResponse, error)
func (*Bundle) PlistReader ¶
type BundleFileExtension ¶
type BundleFileExtension string
const ( BundleFileExtensionAndroid BundleFileExtension = ".apk" BundleFileExtensionIOS BundleFileExtension = ".ipa" )
func (BundleFileExtension) IsValid ¶
func (ext BundleFileExtension) IsValid() bool
func (BundleFileExtension) PlatformType ¶
func (ext BundleFileExtension) PlatformType() BundlePlatformType
type BundleInfo ¶
type BundleInfo struct { Version string Identifier string PlatformType BundlePlatformType }
a BundleInfo is information of an application package(apk file, ipa file, etc.)
func NewBundleInfo ¶
func NewBundleInfo(file *os.File, platformType BundlePlatformType) (*BundleInfo, error)
type BundleJsonResponse ¶
type BundleJsonResponse struct { FileId string `json:"file_id"` Version string `json:"version"` Revision int `json:"revision"` InstallUrl string `json:"install_url"` QrCodeUrl string `json:"qr_code_url"` PlatformType string `json:"platform_type"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
type BundleParseError ¶
type BundleParseError struct {
Offset int64
}
func (*BundleParseError) Error ¶
func (e *BundleParseError) Error() string
type BundlePlatformType ¶
type BundlePlatformType int
const ( BundlePlatformTypeAndroid BundlePlatformType = 1 + iota BundlePlatformTypeIOS )
func (BundlePlatformType) Extention ¶
func (platformType BundlePlatformType) Extention() BundleFileExtension
func (BundlePlatformType) String ¶
func (platformType BundlePlatformType) String() string
type Bundles ¶
type Bundles []*Bundle
func (Bundles) JsonResponse ¶
func (bundles Bundles) JsonResponse(ub UriBuilder) ([]*BundleJsonResponse, error)
type BundlesJsonResponse ¶
type BundlesJsonResponse struct { TotalCount int `json:"total_count"` Page int `json:"page"` Limit int `json:"limit"` Bundles []*BundleJsonResponse `json:"bundles"` }
type CapacityInfo ¶
type GoogleService ¶
type GoogleService struct { AccessToken string Client *http.Client OAuth2Service *oauth2.Service DriveService *drive.Service AboutService *drive.AboutService FilesService *drive.FilesService PermissionsService *drive.PermissionsService }
func NewGoogleService ¶
func NewGoogleService(token *oauth.Token) (*GoogleService, error)
func (*GoogleService) CreateFolder ¶
func (s *GoogleService) CreateFolder(folderName string) (*drive.File, error)
func (*GoogleService) CreateUserPermission ¶
func (s *GoogleService) CreateUserPermission(email string, role string) *drive.Permission
func (*GoogleService) DeleteAllFiles ¶
func (s *GoogleService) DeleteAllFiles() error
func (*GoogleService) DeleteFile ¶
func (s *GoogleService) DeleteFile(fileId string) error
func (*GoogleService) DeletePermission ¶
func (s *GoogleService) DeletePermission(fileId string, permissionId string) error
func (*GoogleService) DownloadFile ¶
func (s *GoogleService) DownloadFile(fileId string) (*http.Response, *drive.File, error)
func (*GoogleService) GetAbout ¶
func (s *GoogleService) GetAbout() (*drive.About, error)
func (*GoogleService) GetCapacityInfo ¶
func (s *GoogleService) GetCapacityInfo() (*CapacityInfo, error)
func (*GoogleService) GetFile ¶
func (s *GoogleService) GetFile(fileId string) (*drive.File, error)
func (*GoogleService) GetFileList ¶
func (s *GoogleService) GetFileList() (*drive.FileList, error)
func (*GoogleService) GetPermissionList ¶
func (s *GoogleService) GetPermissionList(fileId string) (*drive.PermissionList, error)
func (*GoogleService) GetSharedFileList ¶
func (s *GoogleService) GetSharedFileList(ownerEmail string) (*drive.FileList, error)
func (*GoogleService) GetTokenInfo ¶
func (s *GoogleService) GetTokenInfo() (*oauth2.Tokeninfo, error)
func (*GoogleService) GetUserInfo ¶
func (s *GoogleService) GetUserInfo() (*oauth2.Userinfoplus, error)
func (*GoogleService) InsertFile ¶
func (s *GoogleService) InsertFile(file *os.File, filename string, parent *drive.ParentReference) (*drive.File, error)
func (*GoogleService) InsertPermission ¶
func (s *GoogleService) InsertPermission(fileId string, permission *drive.Permission) (*drive.Permission, error)
func (*GoogleService) UpdateFileTitle ¶
func (s *GoogleService) UpdateFileTitle(fileId string, title string) error
func (*GoogleService) UpdatePermission ¶
func (sa *GoogleService) UpdatePermission(fileId string, permissionId string, permission *drive.Permission) (*drive.Permission, error)
type LimitedTimeSignatureInfo ¶
type LimitedTimeSignatureInfo struct { Signature string ParamToSign *ParamToSign }
func NewLimitedTimeSignatureInfo ¶
func NewLimitedTimeSignatureInfo(host, path string) *LimitedTimeSignatureInfo
func (*LimitedTimeSignatureInfo) IsExpired ¶
func (signatureInfo *LimitedTimeSignatureInfo) IsExpired() (bool, error)
func (*LimitedTimeSignatureInfo) IsValid ¶
func (signatureInfo *LimitedTimeSignatureInfo) IsValid(key string) (bool, error)
func (*LimitedTimeSignatureInfo) RefreshSignature ¶
func (signatureInfo *LimitedTimeSignatureInfo) RefreshSignature(key string)
func (*LimitedTimeSignatureInfo) UrlValues ¶
func (signatureInfo *LimitedTimeSignatureInfo) UrlValues() *url.Values
type ParamToSign ¶
func (*ParamToSign) String ¶
func (param *ParamToSign) String() string
type ServiceAccountConfig ¶
type User ¶
type User struct { Id int `db:"id"` Email string `db:"email"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
func FindOrCreateUser ¶
func FindOrCreateUser(txn gorp.SqlExecutor, email string) (*User, error)
func GetUserFromEmail ¶
func GetUserFromEmail(txn gorp.SqlExecutor, email string) (*User, error)
func (*User) Validate ¶
func (user *User) Validate(v *revel.Validation)
Click to show internal directories.
Click to hide internal directories.