Skip to content

Instantly share code, notes, and snippets.

@arielpasilang
Last active September 15, 2022 04:13
Show Gist options
  • Save arielpasilang/efd322a6881097935cf505dc6a74e999 to your computer and use it in GitHub Desktop.
Save arielpasilang/efd322a6881097935cf505dc6a74e999 to your computer and use it in GitHub Desktop.
Graphql(Apollo Server)

Webriq - Graphql(Apollo Server)

Server Hosted - https://webriq-app-graphql.herokuapp.com/

Table Of Contents

  1. Authentication
  2. Account
  3. Billings
  4. Sites
  5. Services
  6. Site Templates
  7. Site Subscriptions
  8. Site Members
  9. Subscription Plans
  10. Countries
  11. Currencies
  12. Forms
  13. Analytics

1. Authentication

- Login (New Token)

mutation{
  login(email:"dorelljames@webriq.com", password:"test123")
}

- Logout(Invalidate Token)

mutation{
 logout(token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsImlzcyI6Imh0dHA6XC9cL3Jlc3QuYXBwLndlYnJpcS5jb21cL2FwaVwvdG9rZW4iLCJpYXQiOjE1Njk4Mjg4NTgsImV4cCI6MTU2OTkxNTI1OCwibmJmIjoxNTY5ODI4ODU4LCJqdGkiOiIyMmY1NmRkZDBhZjBiMDRlNjViZGVhOGJhYWEzOTg3YyJ9._Rk5RxaaWbX0xft6N3r8jdqKtrsXQMMFvK44ZkA_TKQ")
}

- Refresh Token

mutation{
  refreshToken
}

2. Account

- Sign Up

mutation{
  signup(email:"test7@test.com", password:"test") {
    id
    verificationCode
    token
  }
}

- Update Profile Requires Authentication Token

mutation{
  updateProfile(
    firstname:"first_name",
    lastname:"last_name",
    middlename:"middle_name",
    photo:"photo.com/photo",
    phoneNumber:"123-4567",
    address:"permanent address",
    city:"heaven city",
    state:"state of place",
    countryId:"0000",
    zipCode:"1000"
  ){
    firstname
    lastname
    middlename
    photo
    phoneNumber
    address
    city
    state
    countryId
    zipCode
  }
}

- Get User Profile Requires Authentication Token

{
  userProfile {
    id
    firstname
    middlename
    lastname
    photo
    phoneNumber
    address
    city
    state
    countryId
    zipCode
  }
}

- Verify Profile Account This can be sent through email and graphql request were not added.

3. Billings

**-Get Account Billing ** Requires Authentication Token

{
  billings {
    id
    name
    object
    brand
    country
    customer
    cvcCheck
    expMonth
    expYear
    fingerPrint
    funding
    last4
  }
}

-Add New Account Billing Requires Authentication Token

mutation {
  newBilling(number:"4242424242424242", expMonth:12, cvc: "333", expYear:"2042", name:"AP Test4"){
    id
    name
    object
    brand
    country
    customer
    cvcCheck
    expMonth
    expYear
    fingerPrint
    funding
    last4
  }
}

- Remove Account Billing by Card Number Requires Authentication Token

mutation {
  removeBilling(cardNum:"card_1FQr6VIntE1UYqq6KBP43plB")
}

- Set Preferred Account Billing Requires Authentication Token

mutation {
  setPreferredBillingCurrency(currencyId:"Oe6wr5Ar5Ql2")
}

4. Sites

- Get All Sites by Specific Account Requires Authentication Token

{
  sites(pageSize: 10) {
    cursor
    hasMore
    sites {
      id
      primaryOwner
      role
      primaryDomain
      subdomain
      domains {
        id
        name
        isPrimary
        isSSL
      }
      url
      isActive
      isSecure
      createdAt
      updatedAt
    }
    totalCount
  }
}

- Get Site by ID and by specific Account Requires Authentication Token

Note: The return of site by id are nulls and requires fixing.

{
  site(id:"6oqerzpM7zZv"){
    id
    primaryOwner
    role
    primaryDomain
    subdomain
    domains {
      id
      name
      isPrimary
      isSSL
    }
    url
    isActive
    isSecure
    createdAt
    updatedAt
  }
}

- Create New Site Requires Authentication Token

mutation{
  newSite(type:"pages", siteName:"TestSite", siteTemplateId:"2da37Qy7Ek5G"){
    id
    primaryOwner
    role
    primaryDomain
    subdomain
    domains {
      id
    }
    url
    isActive
    isSecure
    createdAt
    updatedAt
  }
}

- Check Site Name Availability

mutation{
  checkSiteName(siteName:"TestSite")
}

5. Services

- Get All Services Requires Authentication Token

{
  services{
    id
    name
    slug
    description
    created
    updated
  }
}

- Get Service by ID Requires Authentication Token

{
  service(id:"zl5o9lM7D8aR"){
    id
    name
    slug
    description
    created
    updated
  }
}

6. Site Templates

- Get All Site Templates Requires Authentication Token

{
  siteTemplates{
    id
    serviceId
    name
    description
    sourceUrl
    demoUrl
    screenshotUrl
    compiler
    buildCmd
    buildDir
    tags
    created
    updated
  }
}

7. Site Subscriptions

- Site Subscriptions Requires Authentication Token

mutation {
  siteSubscribe(siteId:"Oe6wr5K475Ql", planToken:"pages--mad-maintenance--usd--monthly--v8"){
    id
    siteId
    userId
    billingTokenId
    billingAccountId
    subscriptionPlanId
    discountId
    currencyId
    token
    amount
    interval
    quantity
    trialEndsAt
    subscriptionEndsAt
    cancelledAt
    isActive
    isPending
    isAddOn
    isFree
    isPastDue
    createdAt
    updatedAt
    deletedAt
  }
}

- Unsubscribe Site Requires Authentication Token

mutation{
  siteUnSubscribe(siteId:"RG1M944w9X2x")
}

8. Site Members

- Invite Members Requires Authentication Token

mutation {
  inviteMembers(siteId:"6oqerzpM7zZv", role:"developer", email:"developer2@dev.com"){
    id
    email
    token
    roleId
    siteId
    status
    createdAt
    updatedAt
    role {
      id
      name
      label
    }
  }
}

- Accept Invitation Requires Authentication Token

mutation{
  acceptInvite(siteId:"D8Qw72589zel", token:"b3b7fd7d2fc3c14808622d1f21b3b628")
}

- Decline Invitation Requires Authentication Token

mutation{
  declineInvite(siteId:"D8Qw72589zel", token:"b3b7fd7d2fc3c14808622d1f21b3b628")
}

9. Subscription Plans

- Get All Subscription Plans Requires Authentication Token

{
  subscriptionPlans {
    id
    token
    name
    slug
    label
    description
    amount
    interval
    batch
    isActive
    serviceId
    currencyId
    isAddOn
    createdAt
    updatedAt
  }
}

10. Countries

- Get All Countries Requires Authentication Token

{
  countries{
    id
    name
    isoCode
    isoCode3
    numCode
    phoneCode
    createdAt
    updatedAt
  }
}

11. Currencies

- Get All Currencies Requires Authentication Token

{
  currencies {
    id
    name
    code
    symbol
    createdAt
    updatedAt
  }
}

12. Forms

- Get All Forms by site ID Requires Authentication Token

{
  forms(siteId:"6oqerzpM7zZv"){
    id
    name
    siteUrls
    testUrls
    tags
    recaptcha {
      isDefault
      version
      key
      secret
    }
    uploadSize
    notifications {
      email {
        subject
        from
        to
        cc
        bcc
      }
      webhooks
    }
    validNonces
    isTest
    createdAt
    updatedAt
  }
}

- New Form by Site ID and Form Name Requires Authentication Token

mutation{
  newForm(siteId:"6oqerzpM7zZv", name:"form6"){
    id
    name
    siteUrls
    testUrls
    tags
    recaptcha {
      isDefault
      version
      key
      secret
    }
    uploadSize
    notifications {
      email {
        subject
        from
        to
        cc
        bcc
      }
      webhooks
    }
    validNonces
    isTest
    createdAt
    updatedAt
  }
}

13. Analytics

To Add Analytics Graphql Informations Here

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