Skip to content

Instantly share code, notes, and snippets.

@mayel
Last active February 17, 2022 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayel/79e97e2fc81244e691c842a6594dfdb5 to your computer and use it in GitHub Desktop.
Save mayel/79e97e2fc81244e691c842a6594dfdb5 to your computer and use it in GitHub Desktop.
# signup
mutation {
signup(email:"email1@example.com", password:"mytestpw!", invite_code:"123")
}
# request another email confirmation to be sent
mutation {
requestConfirmEmail(email: "email1@example.com")
}
# confirm my email address with the token that was emailed
mutation {
confirmEmail(token: "my_token_from_the_email") {
accountId
}
}
# request an email to be sent to reset my password if I forgot it
mutation {
requestResetPassword(email: "email1@example.com")
}
# create another with another email
mutation {
signup(email:"email2@example.com", password:"mytestpw!", invite_code:"123")
}
# create user identity linked to the first account
mutation {
createUser(profile: {
name: "test user 1"
}
character: {
username: "username"
}
) {
accountId
user {
character {
username
}
profile {
name
summary
}
}
}
}
# create another user identity linked to the same account
mutation {
createUser(profile: {
name: "test user 2"
}
character: {
username: "other"
}
) {
accountId
user {
character {
username
}
profile {
name
summary
}
}
}
}
# login
mutation {
login(emailOrUsername:"username", password: "mytestpw!") {
currentAccountId
currentUsername
currentUser {
id
profile {
name
summary
}
character {
username
}
userActivities {
objectId
verb {
verb
verbDisplay
}
}
boostActivities {
verb {
verb
verbDisplay
}
}
posts {
id
postContent {
htmlBody
summary
title
}
}
}
}
}
# change my password
mutation {
changePassword(oldPassword: "mytestpw!", password: "mytestpw2", passwordConfirmation: "mytestpw2") {
accountId
}
}
# follow a user
mutation{
follow(username: "other") {
id
}
}
# post something
mutation {
createPost(
postContent:{
htmlBody: "test post with a mention @other"
}
) {
id
activity {
id
}
postContent {
htmlBody
summary
title
}
}
}
# identify as my other user identity
mutation {
selectUser(username: "other") {
currentAccountId
currentUsername
}
}
# post a reply to the above (using that second identity)
mutation {
createPost(
replyTo: "put_the_post_id_here"
postContent:{
htmlBody: "test reply"
}) {
id
activity {
id
}
postContent {
htmlBody
summary
title
}
}
}
# get an activity + with subject/verb/object + nested thread of replies
{ activity(filter: {
activityId: "put_the_ACTIVITY_id_here"
}) {
id
subjectId
subject {
__typename
...on User {
id
profile {
name
summary
}
}
}
objectId
verb {
verb
verbDisplay
}
object {
__typename
}
directReplies {
__typename
activity {
id
object {
__typename
}
}
threadId
replyToId
postContent {
htmlBody
summary
title
}
directReplies {
__typename
activity {
id
object {
__typename
}
}
threadId
replyToId
postContent {
htmlBody
summary
title
}
}
}
}
}
# boost the post
mutation {
boost(id: "put_the_post_id_here") {
id
}
}
# like it
mutation {
like(id: "put_the_post_id_here") {
id
}
}
# get my feed + flags (if I'm admin) + user identities linked to my account, etc
{ me {
accountId
user {
id
profile {
name
summary
}
character {
username
}
}
users {
id
profile {
name
summary
}
character {
username
}
}
flagsForModeration {
id
verb {
verb
verbDisplay
}
subject {
__typename
}
object {
__typename
}
}
userFeed {
id
verb {
verb
verbDisplay
}
object {
__typename
}
}
}
}
# get info about another user
{user(filter: {username: "other"}) {
id
profile {
name
summary
}
character {
username
}
boostActivities {
object {
__typename
}
}
userActivities {
id
verb {
verb
verbDisplay
}
object {
__typename
...on Post {
id
postContent {
htmlBody
summary
title
}
}
...on Intent {
action {
id
}
name
}
...on EconomicEvent {
action {
id
}
note
}
}
}
posts {
id
postContent {
htmlBody
summary
title
}
}
}}
# list activities in a feed (eg: all activities by local users)
{ feed(filter:{feedName: "local"}) {
id
subject {
__typename
...on User {
id
character {
username
}
profile {
name
summary
}
}
}
verb {
verb
verbDisplay
}
object {
__typename
}
}}
# Share the current user identity with a team member. This will give them full access to the currently authenticated user identity. Warning: anyone you add will have admin-level access over this user identity, meaning they can post as this user, read private messages, etc.
mutation {
addTeamMember(label: "Team", usernameOrEmail: "email2@example.com")
}
# Upload an avatar
curl -X POST -F query="mutation { createUser(profile: {name: \"test\"} character: {username: \"test16\"} images: {icon: \"icon\"}){ accountId user {profile{icon}} }}" -F icon=@profile.jpg -H "Accept:application/json" localhost:4000/api/graphql
curl -X POST -F query="mutation { updateUser( images: {icon: \"icon\"}){ accountId user {profile{icon}} }}" -F icon=@profile.jpg -H "Accept:application/json" localhost:4000/api/graphql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment