leafo / streak.club

a website for running creative streaks
https://streak.club
Other
141 stars 19 forks source link

Streak Club API #1

Open catherinemarvin opened 9 years ago

catherinemarvin commented 9 years ago

Need an API for:

The API endpoints are just suggestions

charles-l commented 9 years ago

:+1:

catherinemarvin commented 9 years ago

Can you expose the streak title in /my-streaks ? It looks like it's missing.

catherinemarvin commented 9 years ago

As well as the "number of participants in the streak"/"number of submissions" and the frequency (ex. daily)

leafo commented 9 years ago

Deployed

catherinemarvin commented 9 years ago

Did you change something? I'm getting back Code=-1011 "Request failed: internal server error (500)" UserInfo=0x7f90c8c99610 {NSUnderlyingError=0x7f90c924f930 "Request failed: unacceptable content-type: text/html", when making a call to my-streaks.

catherinemarvin commented 9 years ago

Still need "number of participants in the streak" and "number of submissions" to get the home page to parity with .com

qaisjp commented 9 years ago

um

catherinemarvin commented 9 years ago

Still seems to be missing submissions count and users count:

hosted = { completed = ( { category = other; "end_date" = "2015-05-07"; host = { id = 11; username = khwang; }; "hour_offset" = "-7"; id = 549; "publish_status" = draft; rate = daily; "short_description" = "Testing 1 2 3"; "start_date" = "2015-04-30"; title = "Sample Streak"; } ); };

leafo commented 9 years ago

sorry, forgot to deploy. Should be there now @khwang

leafo commented 9 years ago

also fixed that isseu @qaisjp thanks

leafo commented 9 years ago

/streak/:id/ -- get information about a streak by id

The streak_user field is present if the current logged in user is in this streak.

{
  streak_user = {
    pending = false,
    created_at = "2015-07-15 03:23:56",
    submissions_count = 0,
    longest_streak = 0, -- can be nil
    current_streak = 0 -- can be nil
  },
  streak = {
    rate = "daily",
    category = "other",
    id = 291,
    publish_status = "published",
    host = {
      username = "user-20",
      id = 827
    },
    hour_offset = 0,
    title = "streak-11",
    end_date = "2015-08-04",
    short_description = "short description for 11",
    users_count = 0,
    submissions_count = 0,
    start_date = "2015-07-15"
  }
}
leafo commented 9 years ago

/streak/:id/submissions?page=1 -- list submissions for streak, most recent first. page param is optional

{
  page = 1,
  submissions = {
    {
      uploads = {
        {
          type = "image",
          url = "/img/Mix1c2VyX2NvbnRlbnQvdXBsb2Fkcy9pbWFnZS80LnBuZw==/original/Ghfao%2B.png",
          id = 4
        }
      },
      allow_comments = true,
      user = {
        username = "user-3",
        id = 1172
      },
      streaks = {
        {
          title = "streak-1",
          id = 447
        }
      },
      created_at = "2015-07-16 03:31:30",
      likes_count = 1,
      title = "Submission 1",
      published = true,
      streak_submission = {
        submit_time = "2015-07-16 03:31:30",
        late_submit = false
      },
      comments_count = 0,
      submission_like = {

Submissions can be submitted to multiple streaks at once, so each submission has a streaks field with a list of them.

submission_like is only there if the current user has liked that submission