/sts-poc

Primary LanguagePython

STS GraphQL Server

https://897qfp0jei.execute-api.us-east-1.amazonaws.com/dev/graphql

Instructions

Locally

Dev

Learn

  • run CreateUser mutation from below with query variables just below it
  • same with UpdateUser mutation
  • run GetMe query (at any time to see your user)
  • run UpdateUserProfile mutation ... using profile id from last query
  • run UpdateUserNotificationPolicy mutation ... using notificationPolicy id ...
  • trim these queries and mutations down to only what you need, I added everything I could so it would be easier to trim away to what you need.

Graphql API

Queries

Me

query GetMe {
  me {
    id
    firstName
    lastName
    email
    cellPhone
    notificationPolicy {
      id
      allowEmail
      allowSms
      allowMarketing
      created
      updated
    }
    identities {
      edges {
        node {
          id
          provider
          subject
          created
          updated
        }
      }
    }
    contexts {
      edges {
        node {
          id
          type
          status
          profile {
            id
            displayName
            avatar
            bio
            created
            updated
          }
        }
      }
    }
    created
    updated
  }
}

Node

{ node(id: "{ANY_ID_HERE}") }

Mutations

CreateUser

mutation CreateUser($input: CreateUserInput!) {
  createUser(input: $input) {
    ok
    user {
      id
      firstName
      lastName
      email
      cellPhone
      created
      updated
      identities {
        edges {
          node {
            id
            provider
            subject
            created
            updated
          }
        }
      }
      notificationPolicy {
        id
        allowEmail
        allowSms
        allowMarketing
        created
        updated
      }
      contexts {
        edges {
          node {
            id
            type
            status
            profile {
              id
              displayName
              avatar
              bio
              created
              updated
            }
          }
        }
      }
    }
  }
}
{
  "input": {
    "user": {
      "firstName": "Joseph",
      "lastName": "Black",
      "cellPhone": "+14155552671"
    },
    "profile": {
      "displayName": "Joe",
      "avatar": "https://example.com/image.jpg",
      "bio": "My bio\n\nThanks for viewing!"
    },
    "notificationPolicy": {
      "allowEmail": true,
      "allowSms": true,
      "allowMarketing": false
    }
  }
}

UpdateUser

mutation UpdateMyUser($input: UpdateUserInput!) {
  updateUser(input: $input) {
    ok
    user {
      id
      firstName
      lastName
      email
      cellPhone
      created
      updated
      identities {
        edges {
          node {
            id
            provider
            subject
            created
            updated
          }
        }
      }
      notificationPolicy {
        id
        allowEmail
        allowSms
        allowMarketing
        created
        updated
      }
      contexts {
        edges {
          node {
            id
            type
            status
            profile {
              id
              displayName
              avatar
              bio
              created
              updated
            }
          }
        }
      }
    }
  }
}
{
  "input": {
    "user": {
      "lastName": "White"
    },
    "contextId": "VXNlckNvbnRleHQ6MQ==",
    "profile": {
      "displayName": "Joe White"
    },
    "notificationPolicy": {
      "allowMarketing": true
    }
  }
}

*Note: contextId is the id of the context object returned from me, and you should likely store this on the client somewhere as currentUserContextID or whatever, since almost all of the graphql calls in the future will need to know this.