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.
2 1
Tobias friendica (via ActivityPub)
I'll create a PR for this.
1
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/
1
Marco R. friendica
This is difficult. I did the changes on my local server, which runs on the stable branch.
1
Marco R. friendica
The patch file 0001-new-event-APIs.patch is in the Nextcloud directory!
1 1
Tobias friendica (via ActivityPub)
And could you add the new API functions to the documentation at doc/API-Friendica.md.
1
Tobias friendica (via ActivityPub)
The pull request from your patch has been created as 11763.
1
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
Dieser Beitrag wurde bearbeitet. (1 Jahr her)
1
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.
1 1
Hypolite Petovan friendica (via ActivityPub)
Thanks, the PR is merged!
1 1
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?
1
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.
1
Hypolite Petovan friendica (via ActivityPub)
I can, should I also change starDate to start_date and endDate to end_date?
1 1
Marco R. friendica
That would be great!
1 1