Skip to content

Commit

Permalink
publish: REST API: Add partnerships parameter to petition update endp…
Browse files Browse the repository at this point in the history
…oint (#159)

generated from commit c8706a0
  • Loading branch information
lavaturtle committed Oct 16, 2024
1 parent 89690b0 commit 864066f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CREATE TABLE event_imports ("id" integer, "event_import_batch_id" integer, "impo
DROP TABLE IF EXISTS event_types;
CREATE TABLE event_types ("id" bigint, "organisation_id" bigint, "name" CHARACTER VARYING(max), "localized_names" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "crm_settings" CHARACTER VARYING(max));
DROP TABLE IF EXISTS events;
CREATE TABLE events ("id" integer, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "slug" CHARACTER VARYING(max), "start_at" timestamp without time zone, "end_at" timestamp without time zone, "location_id" integer, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "user_id" integer, "organisation_id" integer, "calendar_id" integer, "admin_status" CHARACTER VARYING(max), "admin_reason" CHARACTER VARYING(max), "administered_at" timestamp without time zone, "max_attendees_count" integer, "locale" CHARACTER VARYING(max), "target_id" integer, "thank_attendee_email_content" CHARACTER VARYING(max), "approaching_event_attendee_email_content" CHARACTER VARYING(max), "notify_changes_to_attendees" boolean, "sharing_disabled" boolean, "host_address" CHARACTER VARYING(max), "cancel_reason" CHARACTER VARYING(max), "cancelled_at" timestamp without time zone, "local_chapter_id" integer, "launched_at" timestamp without time zone, "hidden_address" boolean, "promoted_from_waitlist_email_content" CHARACTER VARYING(max), "petition_id" integer, "extra_location_info" CHARACTER VARYING(max), "external_action_id" CHARACTER VARYING(max), "request_referer" CHARACTER VARYING(max), "time_zone" CHARACTER VARYING(max), "hidden_at" timestamp without time zone, "daisy_chain_id" bigint, "new_member_daisy_chain_id" bigint, "forum_enabled" boolean, "reviewer_id" integer, "event_type_id" integer, "region_id" bigint, "settings" CHARACTER VARYING(max), "campaigner_contactable" boolean, "crm_settings" CHARACTER VARYING(max), "created_by_id" bigint, "reviewer_type" CHARACTER VARYING(max), "mentor_id" bigint, "redirect_to" CHARACTER VARYING(max), "web_conference_url" CHARACTER VARYING(max), "virtual" boolean, "content_updated_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "featured" boolean, "theme_id" bigint, "utm_params" CHARACTER VARYING(max), "location_venue" CHARACTER VARYING(max), "user_ip" CHARACTER VARYING(max), "user_agent" CHARACTER VARYING(max));
CREATE TABLE events ("id" integer, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "slug" CHARACTER VARYING(max), "start_at" timestamp without time zone, "end_at" timestamp without time zone, "location_id" integer, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "user_id" integer, "organisation_id" integer, "calendar_id" integer, "admin_status" CHARACTER VARYING(max), "admin_reason" CHARACTER VARYING(max), "administered_at" timestamp without time zone, "max_attendees_count" integer, "locale" CHARACTER VARYING(max), "target_id" integer, "thank_attendee_email_content" CHARACTER VARYING(max), "approaching_event_attendee_email_content" CHARACTER VARYING(max), "notify_changes_to_attendees" boolean, "sharing_disabled" boolean, "host_address" CHARACTER VARYING(max), "cancel_reason" CHARACTER VARYING(max), "cancelled_at" timestamp without time zone, "local_chapter_id" integer, "launched_at" timestamp without time zone, "hidden_address" boolean, "promoted_from_waitlist_email_content" CHARACTER VARYING(max), "petition_id" integer, "extra_location_info" CHARACTER VARYING(max), "external_action_id" CHARACTER VARYING(max), "request_referer" CHARACTER VARYING(max), "time_zone" CHARACTER VARYING(max), "hidden_at" timestamp without time zone, "daisy_chain_id" bigint, "new_member_daisy_chain_id" bigint, "forum_enabled" boolean, "reviewer_id" integer, "event_type_id" integer, "region_id" bigint, "settings" CHARACTER VARYING(max), "campaigner_contactable" boolean, "crm_settings" CHARACTER VARYING(max), "created_by_id" bigint, "reviewer_type" CHARACTER VARYING(max), "mentor_id" bigint, "redirect_to" CHARACTER VARYING(max), "web_conference_url" CHARACTER VARYING(max), "virtual" boolean, "content_updated_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "featured" boolean, "theme_id" bigint, "utm_params" CHARACTER VARYING(max), "location_venue" CHARACTER VARYING(max), "unconfirmed_location" boolean, "user_ip" CHARACTER VARYING(max), "user_agent" CHARACTER VARYING(max));
DROP TABLE IF EXISTS export_download_logs;
CREATE TABLE export_download_logs ("id" bigint, "user_id" bigint, "data_export_id" bigint, "created_at" timestamp without time zone);
DROP TABLE IF EXISTS external_events;
Expand Down
47 changes: 47 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@
<li>
<a href="#webhook-endpoints-petition-inappropriate-creator_message" class="toc-h2 toc-link" data-title="petition.inappropriate.creator_message">petition.inappropriate.creator_message</a>
</li>
<li>
<a href="#webhook-endpoints-petition-member_email_reply_received" class="toc-h2 toc-link" data-title="petition.member_email_reply_received">petition.member_email_reply_received</a>
</li>
<li>
<a href="#webhook-endpoints-petition-mentor_assigned" class="toc-h2 toc-link" data-title="petition.mentor_assigned">petition.mentor_assigned</a>
</li>
Expand Down Expand Up @@ -2744,6 +2747,10 @@ <h2 id='webhook-endpoints-webhook-types-summary'>Webhook types summary</h2>
<td>An inappropriate petition&#39;s creator writes a message to admins</td>
</tr>
<tr>
<td><a href="#webhook-endpoints-petition-member_email_reply_received">petition.member_email_reply_received</a></td>
<td>A member replied to a petition email</td>
</tr>
<tr>
<td><a href="#webhook-endpoints-petition-mentor_assigned">petition.mentor_assigned</a></td>
<td>Mentor was assigned to the petition</td>
</tr>
Expand Down Expand Up @@ -3028,6 +3035,7 @@ <h2 id='webhook-endpoints-event-created'>event.created</h2>
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2021-07-23T19:09:41Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"location_venue"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Queens Public Library at McGoldrick"</span><span class="p">,</span><span class="w">
</span><span class="nl">"unconfirmed_location"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"host"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">180</span><span class="p">,</span><span class="w">
</span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
Expand Down Expand Up @@ -3120,6 +3128,7 @@ <h2 id='webhook-endpoints-event-created-requires_moderation'>event.created.requi
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2021-07-23T19:09:41Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"location_venue"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Queens Public Library at McGoldrick"</span><span class="p">,</span><span class="w">
</span><span class="nl">"unconfirmed_location"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"host"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">180</span><span class="p">,</span><span class="w">
</span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
Expand Down Expand Up @@ -3242,6 +3251,7 @@ <h2 id='webhook-endpoints-event-mentor_assigned'>event.mentor_assigned</h2>
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2021-07-23T19:09:41Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"location_venue"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Queens Public Library at McGoldrick"</span><span class="p">,</span><span class="w">
</span><span class="nl">"unconfirmed_location"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"host"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">180</span><span class="p">,</span><span class="w">
</span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
Expand Down Expand Up @@ -3334,6 +3344,7 @@ <h2 id='webhook-endpoints-event-mentor_removed'>event.mentor_removed</h2>
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2021-07-23T19:09:41Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"location_venue"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Queens Public Library at McGoldrick"</span><span class="p">,</span><span class="w">
</span><span class="nl">"unconfirmed_location"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"host"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">180</span><span class="p">,</span><span class="w">
</span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
Expand Down Expand Up @@ -3423,6 +3434,7 @@ <h2 id='webhook-endpoints-event-updated'>event.updated</h2>
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2021-07-23T19:09:41Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"location_venue"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Queens Public Library at McGoldrick"</span><span class="p">,</span><span class="w">
</span><span class="nl">"unconfirmed_location"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"host"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">180</span><span class="p">,</span><span class="w">
</span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
Expand Down Expand Up @@ -4419,6 +4431,36 @@ <h2 id='webhook-endpoints-petition-inappropriate-creator_message'>petition.inapp
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<p>An inappropriate petition&#39;s creator writes a message to admins</p>
<h2 id='webhook-endpoints-petition-member_email_reply_received'>petition.member_email_reply_received</h2>
<blockquote>
<p>Example payload for <code>petition.member_email_reply_received</code>:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"petition.member_email_reply_received"</span><span class="p">,</span><span class="w">
</span><span class="nl">"data"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">359</span><span class="p">,</span><span class="w">
</span><span class="nl">"campaign_type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Event"</span><span class="p">,</span><span class="w">
</span><span class="nl">"campaign_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">8268</span><span class="p">,</span><span class="w">
</span><span class="nl">"replied_email_type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"blast_email"</span><span class="p">,</span><span class="w">
</span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"verified_pending_delivery"</span><span class="p">,</span><span class="w">
</span><span class="nl">"from"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Jane Doe &lt;[email protected]&gt;"</span><span class="p">,</span><span class="w">
</span><span class="nl">"to"</span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
</span><span class="nl">"subject"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Re: We made it!"</span><span class="p">,</span><span class="w">
</span><span class="nl">"body_plain"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Hi Jane, I'm so glad we made it! I can't wait to see you at the event. Best, John"</span><span class="p">,</span><span class="w">
</span><span class="nl">"body_html"</span><span class="p">:</span><span class="w"> </span><span class="s2">"&lt;p&gt;Hi Jane, I'm so glad we made it! I can't wait to see you at the event.&lt;/p&gt;&lt;p&gt;Best, John&lt;/p&gt;"</span><span class="p">,</span><span class="w">
</span><span class="nl">"headers"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"Message-ID"</span><span class="p">:</span><span class="w"> </span><span class="s2">"&lt;abcde-098765&gt;"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"blast_email_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">87</span><span class="p">,</span><span class="w">
</span><span class="nl">"member_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">1234</span><span class="p">,</span><span class="w">
</span><span class="nl">"reject_reasons"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"created_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2024-09-12T15:00:00Z"</span><span class="p">,</span><span class="w">
</span><span class="nl">"updated_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2024-09-12T16:30:00Z"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"jid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"030ee43a4fa9788e084d9cfc"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<p>A member replied to a petition email</p>
<h2 id='webhook-endpoints-petition-mentor_assigned'>petition.mentor_assigned</h2>
<blockquote>
<p>Example payload for <code>petition.mentor_assigned</code>:</p>
Expand Down Expand Up @@ -7423,6 +7465,11 @@ <h3 id='authenticated-rest-api-petitions-update'>Update</h3>
<td>Turn off the form that allows people to sign the petition via the petition page</td>
</tr>
<tr>
<td>partnerships</td>
<td>Array</td>
<td>List of partnerships this petition should be associated with, formatted like <code>[{&quot;slug&quot;: &quot;foo&quot;}, {&quot;slug&quot;: &quot;bar&quot;}]</code>. If the petition was associated with any partnerships that are not included in the list, it will be removed from those partnerships.</td>
</tr>
<tr>
<td>petition_creator_name_override</td>
<td>String</td>
<td>Name to display for the petition creator on the petition page. Set to <code>null</code> to use the name from the petition creator&#39;s user account.</td>
Expand Down

0 comments on commit 864066f

Please sign in to comment.