freunde.ma-nic.de

Marco R. friendica

APIs to create, amend and delete events

Hi !Friendica Developers
As I am sick at home, I created two new APIs for events: Create and Delete.
The code is here at my Nextcloud: https://daten.ma-nic.de/index.php/s/47KKkZHXE5wo5x4
It would be nice if someone has a look at it and integrates it into the develop branch. They work for me so far (except the ACL for the Create API, the allow_gid seems to get ignored). I have no account at Github, so I can not open issues for them or create a PR (or can I do PRs from git.friendi.ca?). I hope I did everything correct and didn't introduce security holes.
Feel free to ask questions.
Friendica Developers reshared this.
Tobias friendica (via ActivityPub)
I'll create a PR for this.
Friendica Developers reshared this.
Tobias friendica (via ActivityPub)
Could you create a "patch" with git from your local repository? https://www.git-tower.com/learn/git/faq/create-and-apply-patch/
Friendica Developers reshared this.
Marco R. friendica
This is difficult. I did the changes on my local server, which runs on the stable branch.
Friendica Developers reshared this.
Marco R. friendica
The patch file 0001-new-event-APIs.patch is in the Nextcloud directory!
Friendica Developers reshared this.
Tobias friendica (via ActivityPub)
And could you add the new API functions to the documentation at doc/API-Friendica.md.
Friendica Developers reshared this.
Tobias friendica (via ActivityPub)
The pull request from your patch has been created as 11763.
Friendica Developers reshared this.
Hypolite Petovan friendica (via ActivityPub)
In src/Module/Api/Friendica/Events/Create.php:110, the referenced variable $cid is never declared, which makes the !$cid always true and so superfluous.

https://github.com/friendica/friendica/pull/11763#discussion_r928101589
This entry was edited (3 weeks ago)
Friendica Developers reshared this.
Marco R. friendica
That part of the code was taken from the events_post function in mod/events.php. I don't know what is tested there, the $cid value seems part of a POST request. I think it can be removed from the if function.
Friendica Developers reshared this.
Hypolite Petovan friendica (via ActivityPub)
Thanks, the PR is merged!
Friendica Developers reshared this.
Michael Vogel friendica (via ActivityPub)
Sorry for being a nitpicker, but I really prefer a unique schema. I hadn't got a look, but how is it at the other places of the API?
Friendica Developers reshared this.
Marco R. friendica
Hi Michael, the name of the event related parameters were taken from the Activitypub documentation (https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event) when I created the friendica/events API some months or years ago.
The friendica/events API also returns the allow_cid, allow_gid, deny_cid, deny_gid values. These parameters are also used in the api/friendica/photo/update, /api/friendica/photo/create APIs and in the /api/status/update (before the change to the class structure). Are there any plans to change all of them?
Friendica Developers reshared this.
Michael Vogel friendica (via ActivityPub)
I had got a short look at the Mastodon API. There the underscore is used. I think we should unify it to that behaviour.

We would use the AP vocabulary when we implemented C2S, which isn't in the planning yet.
Friendica Developers reshared this.
Marco R. friendica
So startDate will be start_date and endDate will be end_date in all APIs (/event_create and /events)? That would be a small breaking change for my Friendiqa client. But that wouldn't be the first breaking change in the API...
On thing I noticed after looking at the commits:
```
$event['type'] = 'event';
```
somehow didn't make it in the final version. Can someone please integrate it? Sorry for the error.
Friendica Developers reshared this.
Hypolite Petovan friendica (via ActivityPub)
I can, should I also change starDate to start_date and endDate to end_date?
Friendica Developers reshared this.
Marco R. friendica
That would be great!
Friendica Developers reshared this.