mirror of
https://github.com/majd/ipatool
synced 2026-11-26 17:27:52 +08:00
Expose Lookup API (#172)
This commit is contained in:
1 parent
8762eaf192
commit
5abc5d1777
2 files changed
+26
No files matched your search
@@ -13,6 +13,7 @@ type AppStore interface {
|
||||
Login(email, password, authCode string) (LoginOutput, error)
|
||||
Info() (InfoOutput, error)
|
||||
Revoke() error
|
||||
Lookup(bundleID string) (LookupOutput, error)
|
||||
Search(term string, limit int64) (SearchOutput, error)
|
||||
Purchase(bundleID string) error
|
||||
Download(bundleID string, outputPath string, acquireLicense bool) (DownloadOutput, error)
|
||||
|
||||
@@ -7,6 +7,31 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type LookupOutput struct {
|
||||
App App
|
||||
}
|
||||
|
||||
func (a *appstore) Lookup(bundleID string) (LookupOutput, error) {
|
||||
acc, err := a.account()
|
||||
if err != nil {
|
||||
return LookupOutput{}, errors.Wrap(err, ErrGetAccount.Error())
|
||||
}
|
||||
|
||||
countryCode, err := a.countryCodeFromStoreFront(acc.StoreFront)
|
||||
if err != nil {
|
||||
return LookupOutput{}, errors.Wrap(err, ErrInvalidCountryCode.Error())
|
||||
}
|
||||
|
||||
app, err := a.lookup(bundleID, countryCode)
|
||||
if err != nil {
|
||||
return LookupOutput{}, err
|
||||
}
|
||||
|
||||
return LookupOutput{
|
||||
App: app,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *appstore) lookup(bundleID, countryCode string) (App, error) {
|
||||
if StoreFronts[countryCode] == "" {
|
||||
return App{}, ErrInvalidCountryCode
|
||||
|
||||
Reference in new issue
Block a user