Skip to content

Commit 39419a5

Browse files
api(collections): Return the publication_frequency_per_year attribute
1 parent 5907493 commit 39419a5

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

docs/api/collections.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ $ curl -H "Content-Type: application/json" \
2727
"description": "",
2828
"group": null,
2929
"is_public": false,
30-
"is_followed": false
30+
"is_followed": false,
31+
"publication_frequency_per_year": 4
3132
},
3233
{
3334
"id": "1833740002944268171",
3435
"name": "My shares",
3536
"description": "",
3637
"group": null,
3738
"is_public": true,
38-
"is_followed": false
39+
"is_followed": false,
40+
"publication_frequency_per_year": 42
3941
}
4042
]
4143
```
@@ -51,7 +53,7 @@ $ curl -H "Content-Type: application/json" \
5153
### Changelog
5254

5355
- 2.0.0: added
54-
- 2.0.5: `is_followed` attribute added
56+
- 2.0.5: `is_followed` and `publication_frequency_per_year` attributes added
5557

5658
## Create a collection
5759

@@ -86,7 +88,8 @@ $ curl -H "Content-Type: application/json" \
8688
"description": "The description",
8789
"group": null,
8890
"is_public": true,
89-
"is_followed": false
91+
"is_followed": false,
92+
"publication_frequency_per_year": 0
9093
}
9194
```
9295

@@ -125,7 +128,7 @@ $ curl -H "Content-Type: application/json" \
125128
### Changelog
126129

127130
- 2.0.0: added
128-
- 2.0.5: `is_followed` attribute added
131+
- 2.0.5: `is_followed` and `publication_frequency_per_year` attributes added
129132

130133
## Get a collection
131134

@@ -153,7 +156,8 @@ $ curl -H "Content-Type: application/json" \
153156
"description": "The description",
154157
"group": null,
155158
"is_public": true,
156-
"is_followed": false
159+
"is_followed": false,
160+
"publication_frequency_per_year": 0
157161
}
158162
```
159163

@@ -184,7 +188,7 @@ $ curl -H "Content-Type: application/json" \
184188
### Changelog
185189

186190
- 2.0.0: added
187-
- 2.0.5: `is_followed` attribute added
191+
- 2.0.5: `is_followed` and `publication_frequency_per_year` attributes added
188192

189193
## Update a collection
190194

@@ -219,7 +223,8 @@ $ curl -H "Content-Type: application/json" \
219223
"description": "The description",
220224
"group": null,
221225
"is_public": false,
222-
"is_followed": false
226+
"is_followed": false,
227+
"publication_frequency_per_year": 0
223228
}
224229
```
225230

@@ -274,7 +279,7 @@ $ curl -H "Content-Type: application/json" \
274279
### Changelog
275280

276281
- 2.0.0: added
277-
- 2.0.5: `is_followed` attribute added
282+
- 2.0.5: `is_followed` and `publication_frequency_per_year` attributes added
278283

279284
## Delete a collection
280285

docs/api/search.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ $ curl -H "Content-Type: application/json" \
5252
"url": "https://flus.fr/carnet/feeds/all.atom.xml",
5353
"type": "atom",
5454
"site_url": "https://flus.fr/carnet/",
55-
"is_followed": false
55+
"is_followed": false,
56+
"publication_frequency_per_year": 24
5657
}
5758
]
5859
}

src/models/Collection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ public function toJson(User $context_user): array
431431
'type' => $this->feed_type,
432432
'site_url' => $this->feed_site_url,
433433
'is_followed' => $context_user->isFollowing($this->id),
434+
'publication_frequency_per_year' => $this->publication_frequency_per_year,
434435
];
435436
} else {
436437
return [
@@ -440,6 +441,7 @@ public function toJson(User $context_user): array
440441
'group' => $this->groupForUser($context_user->id)?->name,
441442
'is_public' => $this->is_public,
442443
'is_followed' => $context_user->isFollowing($this->id),
444+
'publication_frequency_per_year' => $this->publication_frequency_per_year,
443445
];
444446
}
445447
}

0 commit comments

Comments
 (0)