예제 #1
0
 public static IPromise <Res.User> Me()
 {
     return(get <Res.MeResponse>("/users/me").Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.User(res.user);
     }));
 }
예제 #2
0
 public static IPromise <List <Res.Avatar> > QueryInitial()
 {
     return(get <Res.AvatarsResponse>("/avatars/initial").Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Avatars(res.avatars);
     }));
 }
예제 #3
0
 public static IPromise <Res.Leaflet> GetById(string id)
 {
     return(get <Res.LeafletResponse>("/leaflets/" + id)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Leaflet(res.leaflet);
     }));
 }
예제 #4
0
 public static IPromise <Res.Protest> GetById(string id)
 {
     return(get <Res.ProtestResponse>("/protests/" + id)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Protest(res.protest);
     }));
 }
예제 #5
0
 public static IPromise <Res.Place> GetById(uint id)
 {
     return(get <Res.PlaceResponse>("/places/" + id.ToString())
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Place(res.place);
     }));
 }
예제 #6
0
 /*
  * GetAll - request all places
  */
 public static IPromise <List <Res.Place> > QueryAll()
 {
     return(get <Res.PlacesResponse>("/places")
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Places(res.places);
     }));
 }
예제 #7
0
 public static IPromise <List <Res.Event> > QueryNotSeen()
 {
     return(get <Res.EventsResponse>("/events")
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Events(res.events);
     }));
 }
예제 #8
0
 public static IPromise <List <Res.Signatory> > QuerySignatories(string leafletId)
 {
     return(get <Res.SignatoriesResponse>("/leaflets/" + leafletId + "/signatories")
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Signatories(res.signatories);
     }));
 }
예제 #9
0
 public static IPromise <List <Res.Participant> > QueryActiveParticipants(string protestId)
 {
     return(get <Res.ParticipantsResponse>("/protests/" + protestId + "/activeParticipants")
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Participants(res.participants);
     }));
 }
예제 #10
0
 public static IPromise <Res.Leaflet> DestroyLeaflet(
     string leafletId)
 {
     return(post <Res.LeafletResponse>("/leaflets/" + leafletId + "/destroy")
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Leaflet(res.leaflet);
     }));
 }
예제 #11
0
 public static IPromise <List <Res.User> > TopOrderUsers(uint start, uint count)
 {
     Req.Top req = new Req.Top {
         start = start, count = count
     };
     return(post <Res.UsersResponse>("/ratings/topOrderUsers", req).Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Users(res.users);
     }));
 }
예제 #12
0
 public static IPromise <List <Res.Protest> > QueryByIds(List <string> ids)
 {
     Req.QueryByIds req = new Req.QueryByIds {
         ids = ids
     };
     return(post <Res.ProtestsResponse>("/protests/queryByIds", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Protests(res.protests);
     }));
 }
예제 #13
0
 public static IPromise <Res.UserAvatar> SetAvatarNickname(string userAvatarId, string nickname)
 {
     Req.Nickname req = new Req.Nickname {
         nickname = nickname
     };
     return(post <Res.UserAvatarResponse>("/user-avatars/" + userAvatarId + "/setNickname", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.UserAvatar(res.userAvatar);
     }));
 }
예제 #14
0
 public static IPromise <Res.UserAvatar> SetAvatarType(string userAvatarId, uint avatarId)
 {
     Req.SetAvatarType req = new Req.SetAvatarType {
         avatarId = avatarId
     };
     return(post <Res.UserAvatarResponse>("/user-avatars/" + userAvatarId + "/setType", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.UserAvatar(res.userAvatar);
     }));
 }
예제 #15
0
            public static IPromise <List <Res.Banner> > QueryAll(uint protestTypeId, string language)
            {
                Dictionary <string, string> args = new Dictionary <string, string> {
                    { "protestTypeId", protestTypeId.ToString() },
                    { "language", language }
                };

                return(get <Res.Banners>("/banners", args)
                       .Then(res =>
                {
                    GraphMap g = new GraphMap(res.graph);
                    return g.Banners(res.banners);
                }));
            }
예제 #16
0
 public static IPromise <Res.Participant> LeaveProtest(
     string protestId,
     string userAvatarId)
 {
     Req.LeaveProtest req = new Req.LeaveProtest
     {
         userAvatarId = userAvatarId,
     };
     return(post <Res.ParticipantResponse>("/protests/" + protestId + "/leave", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Participant(res.participant);
     }));
 }
예제 #17
0
 public static IPromise <Res.Signatory> SignLeaflet(
     string leafletId,
     string bannerId,
     List <string> bannerWords)
 {
     Req.SignLeaflet req = new Req.SignLeaflet
     {
         bannerId    = bannerId,
         bannerWords = bannerWords,
     };
     return(post <Res.SignatoryResponse>("/leaflets/" + leafletId + "/sign", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Signatory(res.signatory);
     }));
 }
예제 #18
0
 public static IPromise <Res.Participant> JoinProtest(
     string protestId,
     string userAvatarId,
     string bannerId,
     List <string> bannerWords)
 {
     Req.JoinProtest req = new Req.JoinProtest
     {
         userAvatarId = userAvatarId,
         bannerId     = bannerId,
         bannerWords  = bannerWords,
     };
     return(post <Res.ParticipantResponse>("/protests/" + protestId + "/join", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Participant(res.participant);
     }));
 }
예제 #19
0
 public static IPromise <Res.Leaflet> CreateLeaflet(
     uint placeId,
     uint protestTypeId,
     string bannerId,
     List <string> bannerWords)
 {
     Req.CreateLeaflet req = new Req.CreateLeaflet
     {
         placeId       = placeId,
         protestTypeId = protestTypeId,
         bannerId      = bannerId,
         bannerWords   = bannerWords
     };
     return(post <Res.LeafletResponse>("/leaflets", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Leaflet(res.leaflet);
     }));
 }
예제 #20
0
 public static IPromise <Res.Protest> CreateProtest(
     uint placeId,
     uint protestTypeId,
     string userAvatarId,
     string bannerId,
     List <string> bannerWords,
     uint duration)
 {
     Req.CreateProtest req = new Req.CreateProtest
     {
         placeId       = placeId,
         protestTypeId = protestTypeId,
         userAvatarId  = userAvatarId,
         bannerId      = bannerId,
         bannerWords   = bannerWords,
         duration      = duration
     };
     return(post <Res.ProtestResponse>("/protests", req)
            .Then(res =>
     {
         GraphMap g = new GraphMap(res.graph);
         return g.Protest(res.protest);
     }));
 }