Danh bạ
Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.
Định nghĩa kiểu
type Mutation {
createContact(input: ContactInput!): Contact!
createContactGroup(name: String!, accountName: String!, accountType: String!): ContactGroup!
deleteContactGroup(id: ID!): Boolean!
deleteContacts(query: String!): ActionResult!
updateContact(id: ID!, input: ContactInput!): Contact!
updateContactGroup(id: ID!, name: String!): ContactGroup!
}
type Query {
contactCount(query: String!): Int!
contactGroups: [ContactGroup!]!
contactSources: [ContactSource!]!
contacts(query: String!, offset: Int!, limit: Int!): [Contact!]!
}
type ActionResult {
affectedCount: Int!
}
type Contact {
id: ID!
prefix: String!
firstName: String!
middleName: String!
lastName: String!
suffix: String!
nickname: String!
photoId: String!
phoneNumbers: [ContactPhoneNumber!]!
emails: [ContactEmail!]!
addresses: [ContactAddress!]!
events: [ContactEvent!]!
source: String!
starred: Boolean!
contactId: ID!
thumbnailId: String!
notes: String!
groups: [ContactGroup!]!
organization: ContactOrganization
websites: [ContactWebsite!]!
ims: [ContactIm!]!
ringtone: String!
updatedAt: Instant!
tags: [Tag!]!
}
type ContactAddress {
typeCode: Int!
value: String!
type: ContactPostalType!
label: String!
}
input ContactAddressInput {
value: String!
type: ContactPostalType!
label: String!
}
type ContactEmail {
typeCode: Int!
value: String!
type: ContactEmailType!
label: String!
}
input ContactEmailInput {
value: String!
type: ContactEmailType!
label: String!
}
enum ContactEmailType {
CUSTOM
HOME
WORK
OTHER
MOBILE
}
type ContactEvent {
typeCode: Int!
value: String!
type: ContactEventType!
label: String!
}
input ContactEventInput {
value: String!
type: ContactEventType!
label: String!
}
enum ContactEventType {
CUSTOM
ANNIVERSARY
BIRTHDAY
OTHER
}
type ContactGroup {
id: ID!
name: String!
contactCount: Int!
}
type ContactIm {
typeCode: Int!
value: String!
protocol: ContactImProtocol!
customProtocol: String!
}
input ContactImInput {
value: String!
protocol: ContactImProtocol!
customProtocol: String!
}
enum ContactImProtocol {
CUSTOM
AIM
MSN
YAHOO
SKYPE
QQ
GOOGLE_TALK
ICQ
JABBER
NETMEETING
}
input ContactInput {
prefix: String!
firstName: String!
middleName: String!
lastName: String!
suffix: String!
nickname: String!
phoneNumbers: [ContactPhoneInput!]!
emails: [ContactEmailInput!]!
addresses: [ContactAddressInput!]!
events: [ContactEventInput!]!
source: String!
starred: Boolean!
notes: String!
groupIds: [ID!]!
organization: ContactOrganizationInput
websites: [ContactWebsiteInput!]!
ims: [ContactImInput!]!
}
type ContactOrganization {
company: String!
title: String!
}
input ContactOrganizationInput {
company: String!
title: String!
}
input ContactPhoneInput {
value: String!
type: ContactPhoneType!
label: String!
}
type ContactPhoneNumber {
typeCode: Int!
value: String!
type: ContactPhoneType!
label: String!
normalizedNumber: String!
}
enum ContactPhoneType {
CUSTOM
HOME
MOBILE
WORK
FAX_WORK
FAX_HOME
PAGER
OTHER
CALLBACK
CAR
COMPANY_MAIN
ISDN
MAIN
OTHER_FAX
RADIO
TELEX
TTY_TDD
WORK_MOBILE
WORK_PAGER
ASSISTANT
}
enum ContactPostalType {
CUSTOM
HOME
WORK
OTHER
}
type ContactSource {
name: String!
type: String!
}
type ContactWebsite {
typeCode: Int!
value: String!
type: ContactWebsiteType!
label: String!
}
input ContactWebsiteInput {
value: String!
type: ContactWebsiteType!
label: String!
}
enum ContactWebsiteType {
CUSTOM
HOMEPAGE
BLOG
FTP
HOME
WORK
OTHER
}
enum DataType {
DEFAULT
AUDIO
VIDEO
IMAGE
SMS
CONTACT
NOTE
FEED_ENTRY
CALL
PACKAGE
FILE
APP_FILE
DOC
}
scalar Instant
type Tag {
id: ID!
name: String!
type: DataType!
count: Int!
}Thao tác
createContact
Tạo liên hệ mới.
mutation createContact($input: ContactInput!) {
createContact(input: $input) { id prefix firstName middleName lastName suffix nickname photoId }
}createContactGroup
Tạo nhóm liên hệ trong tài khoản cụ thể.
mutation createContactGroup($name: String!, $accountName: String!, $accountType: String!) {
createContactGroup(name: $name, accountName: $accountName, accountType: $accountType) { id name contactCount }
}deleteContactGroup
Xóa nhóm liên hệ. Liên hệ trong nhóm không bị xóa, chỉ được bỏ khỏi nhóm.
mutation deleteContactGroup($id: ID!) {
deleteContactGroup(id: $id)
}deleteContacts
Xóa mọi liên hệ khớp truy vấn.
mutation deleteContacts($query: String!) {
deleteContacts(query: $query) { affectedCount }
}updateContact
Cập nhật liên hệ hiện có. Chỉ sửa các trường được cung cấp.
mutation updateContact($id: ID!, $input: ContactInput!) {
updateContact(id: $id, input: $input) { id prefix firstName middleName lastName suffix nickname photoId }
}updateContactGroup
Đổi tên nhóm liên hệ.
mutation updateContactGroup($id: ID!, $name: String!) {
updateContactGroup(id: $id, name: $name) { id name contactCount }
}contactCount
Đếm liên hệ khớp truy vấn.
query contactCount($query: String!) {
contactCount(query: $query)
}contactGroups
Liệt kê mọi nhóm liên hệ.
query contactGroups {
contactGroups { id name contactCount }
}contactSources
Liệt kê các nguồn tài khoản liên hệ có sẵn.
query contactSources {
contactSources { name type }
}contacts
Tìm liên hệ. Để query rỗng để liệt kê tất cả.
query contacts($query: String!, $offset: Int!, $limit: Int!) {
contacts(query: $query, offset: $offset, limit: $limit) { id prefix firstName middleName lastName suffix nickname photoId }
}