streak.club icon indicating copy to clipboard operation
streak.club copied to clipboard

Streak Club API

Open catherinemarvin opened this issue 10 years ago • 12 comments
trafficstars

Need an API for:

  • [x] Login (POST users/login)
  • [x] Register (POST users/register)
  • [x] Browsing streaks (GET /streaks)
  • [x] Viewing streak information (GET /streaks/:id)
  • [ ] Creating a streak (POST /streaks)
  • [ ] Submitting a new submission
  • [x] Viewing homepage, list of participating streaks, list of streaks created (GET /my-streaks)
  • [x] Joining and leaving a streak
  • [x] list submissions in a streak

The API endpoints are just suggestions

catherinemarvin avatar Jan 15 '15 01:01 catherinemarvin

:+1:

charles-l avatar Mar 03 '15 12:03 charles-l

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

catherinemarvin avatar May 06 '15 04:05 catherinemarvin

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

catherinemarvin avatar May 06 '15 04:05 catherinemarvin

Deployed

leafo avatar May 11 '15 05:05 leafo

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 avatar May 12 '15 02:05 catherinemarvin

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

catherinemarvin avatar Jun 26 '15 04:06 catherinemarvin

um

qaisjp avatar Jun 26 '15 08:06 qaisjp

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"; } ); };

catherinemarvin avatar Jul 08 '15 01:07 catherinemarvin

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

leafo avatar Jul 15 '15 03:07 leafo

also fixed that isseu @qaisjp thanks

leafo avatar Jul 15 '15 03:07 leafo

/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 avatar Jul 15 '15 03:07 leafo

/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

leafo avatar Jul 16 '15 03:07 leafo