예제 #1
0
 public void Configure(IHateoasResource <NestedTestee> resource)
 {
     resource
     .HasLink("nested-test")
     .HasRouteData(t => new { id = t.Nested.StringValue })
     .HasConditional(t => t.Collection.Any());
 }
예제 #2
0
 public void Configure(IHateoasResource <GenericTestee <object> > resource)
 {
     resource
     .HasLink("generic-test")
     .HasRouteData(t => new { id = t.Nested.ToString() })
     .HasConditional(t => t.Collection.OfType <Testee>().Any());
 }
예제 #3
0
 public void Configure(IHateoasResource <Testee> resource)
 {
     resource
     .HasLink("test")
     .HasRouteData(t => new { id = t.StringValue })
     .HasConditional(t => t.BoolValue);
 }
예제 #4
0
        public void Configure(IHateoasResource <Invite> resource)
        {
            resource.HasLink("accept-invite")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.Status == InviteStatuses.Pending);

            resource.HasLink("decline-invite")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.Status == InviteStatuses.Pending);

            resource.HasLink("cancel-invite")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.Status == InviteStatuses.Pending);

            resource.HasLink("get-invite").HasRouteData(i => new { id = i.Id });
            resource.HasLink("get-guild").HasRouteData(i => new { id = i.GuildId });
            resource.HasLink("get-member").HasRouteData(i => new { id = i.MemberId });
        }
예제 #5
0
        public void Configure(IHateoasResource <Member> resource)
        {
            resource.HasLink("get-member").HasRouteData(e => new { id = e.Id });
            resource.HasLink("update-member").HasRouteData(e => new { id = e.Id });

            resource
            .HasLink("get-guild")
            .HasRouteData(e => new { id = e.GuildId })
            .HasConditional(e => e.GuildId != null);

            resource
            .HasLink("promote-member")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.GuildId != null && !e.IsGuildMaster);

            resource
            .HasLink("demote-member")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.GuildId != null && e.IsGuildMaster);

            resource.HasLink("leave-guild")
            .HasRouteData(e => new { id = e.Id })
            .HasConditional(e => e.GuildId != null);
        }
 public void Configure(IHateoasResource <List <Guild> > resource)
 {
     resource.HasLink("get-guilds");
     resource.HasLink("create-guild");
 }
예제 #7
0
 public void Configure(IHateoasResource <Pagination <Invite> > resource)
 {
     resource.HasLink("get-invites");
     resource.HasLink("invite-member");
 }
 public void Configure(IHateoasResource <List <Member> > resource)
 {
     resource.HasLink("get-members");
     resource.HasLink("invite-member");
     resource.HasLink("create-member");
 }
예제 #9
0
 public void Configure(IHateoasResource <Guild> resource)
 {
     resource.HasLink("get-guild").HasRouteData(g => new { id = g.Id });
     resource.HasLink("get-members").HasRouteData(g => new { guildId = g.Id });
     resource.HasLink("update-guild").HasRouteData(e => new { id = e.Id });
 }