Skip to content

Add Support Tickets + Eligibility endpoints #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

jkmassel
Copy link
Contributor

@jkmassel jkmassel commented May 23, 2025

Adds WP.com support tickets (ie – Zendesk) and support eligibility endpoints.

Support tickets require the ability to upload files – this PR doesn't do that because we'll need to generalize our file upload stuff. I don't think that's a blocker to this PR landing – the majority of the functionality is there.

I've also added a wp_com_e2e package that'll validate that the support tickets / eligibility endpoints function as expected. You can run it like cargo run --bin wp_com_e2e test --token [my_token]. It must be a WordPress iOS token at the moment – we can consider adjusting that later though.

If you run that test (or trust that I did), I think we can consider this PR working. There are also unit tests for parsing the responses, so I think we're pretty well-covered there.

@jkmassel jkmassel force-pushed the add/support-forms branch 3 times, most recently from 029a613 to 4555134 Compare May 23, 2025 17:57
@jkmassel jkmassel changed the title Add/support forms Add Support Tickets + Eligibility endpoints May 23, 2025
@jkmassel jkmassel requested review from oguzkocer and crazytonyli May 23, 2025 18:04
@jkmassel jkmassel self-assigned this May 23, 2025
@jkmassel jkmassel force-pushed the add/support-forms branch from 4555134 to 4a98907 Compare May 23, 2025 18:17
@jkmassel jkmassel marked this pull request as ready for review May 23, 2025 18:17
crazytonyli
crazytonyli previously approved these changes May 25, 2025
pub id: u64,
pub content: String,
pub author: SupportMessageAuthor,
pub role: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment how the author is parsed id depending on the SupportMessageAuthor enum variant order: it's a "User" if the JSON can be parsed as an "User"; then it's a "Agent" if the JSON can be parsed as an "Agent". Would it be more correct to parse author based on the role value, instead of how the SupportMessageAuthor enum type is declared?

#[serde(untagged)]
pub enum SupportMessageAuthor {
User(SupportUserIdentity),
SupportAgent(SupportAgentIdentity),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an "other" variant, just in case the "role" value is some other value, like "system" messages?

.test()
.await?;
SupportTicketsTest { client: &client }.test().await?;
SupportEligibilityTest { client: &client }.test().await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use cargo to run these tests, like the existing integration tests?

@crazytonyli crazytonyli self-requested a review May 25, 2025 23:41
@crazytonyli crazytonyli dismissed their stale review May 25, 2025 23:41

Should have been "Request for changes".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants