Skip to content

Instantly share code, notes, and snippets.

@sduthil
Last active April 9, 2020 20:20
Show Gist options
  • Save sduthil/833a10e56f294243cd98f44a00a1b6a9 to your computer and use it in GitHub Desktop.
Save sduthil/833a10e56f294243cd98f44a00a1b6a9 to your computer and use it in GitHub Desktop.

Functional specs: https://wazo-dev.atlassian.net/browse/WP-42

Get search results:

{
  me {
    contacts(term:pascal, first:2, after:my-cursor) {
      edges {
        node {
          user_uuid
          firstname
          lastname
          main_extension
          extensions(first:2, after:my-cursor) {
            edges {
              is_main
              node {
                exten
              }
            }
            pageInfo {
              startCursor
              endCursor
              hasNextPage
            }
          }
        }
      }
      pageInfo {
        startCursor
        endCursor
        hasNextPage
      }
    }
  }
}

Get favorites:

{
  me {
    contacts(favorite:true, first:2, after:my-cursor) {
      ...skipping edges/node/pageInfo...
      source_id
      contact_id
      user_uuid
      firstname
      lastname
      main_extension
    }
  }
}

Get personal contacts:

{
  me {
    contacts(source:personal, first:2, after:my-cursor) {
      ...skipping edges/node/pageInfo...
      source_id
      contact_id
      user_uuid
      firstname
      lastname
      main_extension
    }
  }
}

Listing available companies:

{
  me {
    contact_companies {
      ...skipping edges/node/pageInfo...
      name
    }
  }
}

OR (requires more processing for response consumer)

{
  me {
    contacts {
      ...skipping edges/node/pageInfo...
      company
    }
  }
}

Get contacts of a company:

{
  me {
    contact_companies(term:wazo) {
      ...skipping edges/node/pageInfo...
      contacts {
        ...skipping edges/node/pageInfo...
        firstname
        lastname
        main_extension
      }
    }
  }
}

Get contact by UUID (multiple contacts by batching queries):

{
  me {
    contact(source:wazo_internal, contact_id:my-uuid) {
      user_uuid
      firstname
      lastname
    }
  }
}

and batch multiple queries with different contact_id

Get contact matching an extension

{
  me {
    contact(exten:4181111111) {
      user_uuid
      firstname
      lastname
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment