Handle publishing to Coopedia through the plugin
-
Add Coopedia username and password fields to the user profile -
Add a settings page for the shortcode URI/classification entity URI at least: -
IDP URI -
Classification URI
-
-
Add some custom fields on Posts for: -
checkbox for posting on coopedia -
checkboxes for the different categories (types/fields/languages/sharing criteria ?)
-
-
Add an action on the publishing of the post which: -
checks if coopedia username and password exists -
if so, shoot a login using a wp_http::post call to the /token endpoint with appropriate info -
retrieves the access_token/id_token -
Compute the selected options for classifications -
Build a json object out of that -
pass the id_token as a Bearer token Authorization header to the call to the /resources/ endpoint of the IDP URI -
Check if the post_meta coopedia_resource_id exists, if not: -
POST to /resources/
-
Analyze the result of the request: -
If it failed, log it somewhere -
If it worked, store the resourceID as a post_meta for further updates
-
-
-
if the post meta coopedia_resource_id exists: -
PUT to /resources/{id}
-
-