textileio / go-textile

[DEPRECATED] Textile is a set of tools and infrastructure for building composable apps and services on the IPFS network
https://textile.io
MIT License
357 stars 43 forks source link

Expose a mobile method to fetch CafeRequest by id #850

Closed asutula closed 5 years ago

asutula commented 5 years ago

Really no idea what i'm doing

asutula commented 5 years ago

Ok, I think that's a legit failure. It's not returning any bytes when I query for the CafeRequest with my new method. Not sure why, could use any ideas.

asutula commented 5 years ago

Could I get some feedback here @sanderpick ?

asutula commented 5 years ago

In the case of an expired refresh token in the native mobile sdks, we need to ask the host application to re-register the cafe. To do that, we'd need to pass the cafe peer id to the host application. To get the cafe peer id, I need some way of getting a peer id from a cafe request id.

asutula commented 5 years ago

Within the context of a failed http request, the only thing I have is the cafe request id. So this would provide a way to map that to cafe information, basically

sanderpick commented 5 years ago

Okay, cool! We could add a method like GetCafeFromGroup to the datastore interface:

type CafeRequestStore interface {
    Queryable
    Add(req *pb.CafeRequest) error
    Get(id string) *pb.CafeRequest
    GetGroup(group string) *pb.CafeRequestList
    GetSyncGroup(group string) string
    Count(status pb.CafeRequest_Status) int
    List(offset string, limit int) *pb.CafeRequestList
    ListGroups(offset string, limit int) []string
    SyncGroupComplete(syncGroupId string) bool
    SyncGroupStatus(groupId string) *pb.CafeSyncGroupStatus
    UpdateStatus(id string, status pb.CafeRequest_Status) error
    UpdateGroupStatus(group string, status pb.CafeRequest_Status) error
    UpdateGroupProgress(group string, transferred int64, total int64) error
    AddAttempt(id string) error
    Delete(id string) error
    DeleteByGroup(groupId string) error
    DeleteBySyncGroup(syncGroupId string) error
    DeleteCompleteSyncGroups() error
    DeleteByCafe(cafeId string) error
}
asutula commented 5 years ago

Sounds good to me. This was a pretty nieve stab at something like that, so we can close this and do the proper thing.

sanderpick commented 5 years ago

Or just make some changes to this?

asutula commented 5 years ago

Ok yea sounds good. Will get back on this asap. For now, I'm updating the photos app to just refresh sessions as needed on start up (as a temporary measure)

sanderpick commented 5 years ago

Sounds good. If we did that plus changed the token expiration to something like 6 months we could table this for now and focus on trying new features like camera roll sync.

asutula commented 5 years ago

Exactly, we're on the same page.

sanderpick commented 5 years ago

Awesome. I'm make an issue.

sanderpick commented 5 years ago

Still needed @asutula ?