API संदर्भ

Contacts

डिवाइस संपर्क पढ़ें, बनाएँ और अपडेट करें।

प्रकार परिभाषाएँ

bash
type Contact {
  id: ID!
  prefix: String!
  firstName: String!
  middleName: String!
  lastName: String!
  suffix: String!
  nickname: String!
  photoId: String!          # use GET /fs?id=<photoId>
  phoneNumbers: [ContactPhoneNumber!]!
  emails: [ContentItem!]!
  addresses: [ContentItem!]!
  events: [ContentItem!]!   # birthdays, anniversaries
  source: String!           # account type e.g. "com.google"
  starred: Boolean!
  contactId: ID!
  thumbnailId: String!
  notes: String!
  groups: [ContactGroup!]!
  organization: Organization
  websites: [ContentItem!]!
  ims: [ContentItem!]!
  ringtone: String!
  updatedAt: String!
}

type ContactPhoneNumber {
  value: String!
  type: Int!     # 1=home 2=mobile 3=work
  label: String!
  normalizedNumber: String!
}

type ContentItem {
  value: String!
  type: Int!
  label: String!
}

type Organization {
  company: String!
  title: String!
}

type ContactGroup {
  id: ID!
  name: String!
  contactCount: Int!
}

type ContactSource {
  name: String!
  accountType: String!
}

input ContactInput {
  firstName: String
  lastName: String
  phoneNumbers: [ContactPhoneNumberInput]
  emails: [ContentItemInput]
  organization: OrganizationInput
}

ऑपरेशन

query

contacts

संपर्क खोजें। सभी सूचीबद्ध करने के लिए query खाली छोड़ें।

bash
query GetContacts($offset: Int!, $limit: Int!, $query: String!) {
  contacts(offset: $offset, limit: $limit, query: $query) {
    id firstName lastName phoneNumbers { value type }
    emails { value } source starred updatedAt
  }
}
query

contactCount

किसी query से मेल खाने वाले संपर्कों की गणना करें।

bash
query GetContactCount($query: String!) {
  contactCount(query: $query)
}
query

contactSources

उपलब्ध संपर्क खाता स्रोतों को सूचीबद्ध करें।

bash
query GetContactSources {
  contactSources { name accountType }
}
query

contactGroups

सभी संपर्क समूहों को सूचीबद्ध करें।

bash
query GetContactGroups {
  contactGroups { id name contactCount }
}
mutation

createContact

एक नया संपर्क बनाएँ।

bash
mutation CreateContact($input: ContactInput!) {
  createContact(input: $input) { id firstName lastName phoneNumbers { value } }
}
mutation

updateContact

किसी मौजूदा संपर्क को अपडेट करें। केवल आपूर्ति किए गए फ़ील्ड संशोधित होते हैं।

bash
mutation UpdateContact($id: ID!, $input: ContactInput!) {
  updateContact(id: $id, input: $input) { id firstName lastName updatedAt }
}
mutation

deleteContacts

किसी query से मेल खाने वाले सभी संपर्क हटाएँ।

bash
mutation DeleteContacts($query: String!) {
  deleteContacts(query: $query)
}
mutation

createContactGroup

किसी विशिष्ट खाते में संपर्क समूह बनाएँ।

bash
mutation CreateContactGroup($name: String!, $accountName: String!, $accountType: String!) {
  createContactGroup(name: $name, accountName: $accountName, accountType: $accountType) {
    id name contactCount
  }
}
mutation

updateContactGroup

एक संपर्क समूह का नाम बदलें।

bash
mutation UpdateContactGroup($id: ID!, $name: String!) {
  updateContactGroup(id: $id, name: $name) { id name }
}
mutation

deleteContactGroup

एक संपर्क समूह हटाएँ। समूह के संपर्क हटाए नहीं जाते, केवल अनग्रुप्ड होते हैं।

bash
mutation DeleteContactGroup($id: ID!) {
  deleteContactGroup(id: $id)
}