# Activity Feeds API

Endpoints for retrieving activity feeds for repositories, organizations, teams, and users.

---

## Endpoints

### GET `/repos/{owner}/{repo}/activities/feeds`

Get the activity feed for a repository.

```bash
curl -s "${FORGEJO_URL}/api/v1/repos/{owner}/{repo}/activities/feeds?limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### GET `/orgs/{org}/activities/feeds`

Get the activity feed for an organization.

```bash
curl -s "${FORGEJO_URL}/api/v1/orgs/{org}/activities/feeds?limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### GET `/teams/{id}/activities/feeds`

Get the activity feed for a team (uses numeric team ID).

```bash
curl -s "${FORGEJO_URL}/api/v1/teams/{team_id}/activities/feeds?limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### GET `/users/{username}/activities/feeds`

Get the activity feed for a user. Use this for both other users and your own feed.

```bash
curl -s "${FORGEJO_URL}/api/v1/users/{username}/activities/feeds?limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

---

## Common Query Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `only-hierarchical` | boolean | Only show hierarchical activities |
| `only-performed-by` | boolean | Only show activities performed by the user (user feed only) |
| `date` | string | Filter by date |
| `page` | int | Page number (1-based) |
| `limit` | int | Page size (number of items per page) |

---

## Activity Feed Entry Fields

Each entry in the feed array contains:

| Field | Type | Description |
|-------|------|-------------|
| `id` | int | Activity ID |
| `op_type` | int | Operation type number (see table below) |
| `act_user` | object | User who performed the action |
| `repo` | object | Repository where the action occurred |
| `content` | string | Activity content/details |
| `created` | string | Timestamp of the activity |

---

## Operation Types (`op_type`)

| Value | Name | Description |
|-------|------|-------------|
| 1 | `create_repo` | Repository created |
| 2 | `rename_repo` | Repository renamed |
| 3 | `star_repo` | Repository starred |
| 4 | `watch_repo` | Repository watched |
| 5 | `commit_repo` | Commits pushed |
| 6 | `create_issue` | Issue created |
| 7 | `create_pull_request` | Pull request created |
| 8 | `transfer_repo` | Repository transferred |
| 9 | `push_tag` | Tag pushed |
| 10 | `comment_issue` | Comment on issue |
| 11 | `merge_pull_request` | Pull request merged |
| 12 | `close_issue` | Issue closed |
| 13 | `reopen_issue` | Issue reopened |
| 14 | `close_pull_request` | Pull request closed |
| 15 | `reopen_pull_request` | Pull request reopened |
| 16 | `delete_tag` | Tag deleted |
| 17 | `delete_branch` | Branch deleted |
| 18 | `mirror_sync_push` | Mirror sync push |
| 19 | `mirror_sync_create` | Mirror sync create |
| 20 | `mirror_sync_delete` | Mirror sync delete |
| 21 | `approve_pull_request` | Pull request approved |
| 22 | `reject_pull_request` | Pull request changes requested |
| 23 | `comment_pull` | Comment on pull request |
| 24 | `publish_release` | Release published |
| 25 | `auto_merge_pull_request` | Pull request auto-merged |
| 26 | `pull_review_dismissed` | Pull request review dismissed |
| 27 | `pull_request_ready_for_review` | Draft PR marked ready for review |
| 28 | `create_branch` | Branch created |

---

## Examples

### Get recent repo activity

```bash
curl -s "${FORGEJO_URL}/api/v1/repos/{owner}/{repo}/activities/feeds?limit=5" \
  -H "Authorization: token ${FORGEJO_PAT}" | jq '.[].op_type'
```

### Get activity for a specific date

```bash
curl -s "${FORGEJO_URL}/api/v1/repos/{owner}/{repo}/activities/feeds?date={date}" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### Paginate through org activity

```bash
# Page 1
curl -s "${FORGEJO_URL}/api/v1/orgs/{org}/activities/feeds?page=1&limit=20" \
  -H "Authorization: token ${FORGEJO_PAT}"

# Page 2
curl -s "${FORGEJO_URL}/api/v1/orgs/{org}/activities/feeds?page=2&limit=20" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### Filter to hierarchical activities only

```bash
curl -s "${FORGEJO_URL}/api/v1/users/{username}/activities/feeds?only-hierarchical=true&limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

### Show only activities performed by the user (excludes events by others in their repos)

```bash
curl -s "${FORGEJO_URL}/api/v1/users/{username}/activities/feeds?only-performed-by=true&limit=10" \
  -H "Authorization: token ${FORGEJO_PAT}"
```

---

## Endpoint Summary

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/repos/{owner}/{repo}/activities/feeds` | Repository activity feed |
| GET | `/orgs/{org}/activities/feeds` | Organization activity feed |
| GET | `/teams/{id}/activities/feeds` | Team activity feed |
| GET | `/users/{username}/activities/feeds` | User activity feed |
