@juzi/wechaty-puppet-service 1.0.13 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/client/puppet-service.d.ts +11 -4
- package/dist/cjs/src/client/puppet-service.d.ts.map +1 -1
- package/dist/cjs/src/client/puppet-service.js +147 -34
- package/dist/cjs/src/client/puppet-service.js.map +1 -1
- package/dist/cjs/src/package-json.js +3 -3
- package/dist/cjs/src/package-json.js.map +1 -1
- package/dist/cjs/src/server/puppet-implementation.d.ts.map +1 -1
- package/dist/cjs/src/server/puppet-implementation.js +171 -47
- package/dist/cjs/src/server/puppet-implementation.js.map +1 -1
- package/dist/esm/src/client/puppet-service.d.ts +11 -4
- package/dist/esm/src/client/puppet-service.d.ts.map +1 -1
- package/dist/esm/src/client/puppet-service.js +147 -34
- package/dist/esm/src/client/puppet-service.js.map +1 -1
- package/dist/esm/src/package-json.js +3 -3
- package/dist/esm/src/package-json.js.map +1 -1
- package/dist/esm/src/server/puppet-implementation.d.ts.map +1 -1
- package/dist/esm/src/server/puppet-implementation.js +171 -47
- package/dist/esm/src/server/puppet-implementation.js.map +1 -1
- package/package.json +3 -3
- package/src/client/puppet-service.ts +222 -41
- package/src/package-json.ts +3 -3
- package/src/server/puppet-implementation.ts +183 -49
|
@@ -1920,82 +1920,263 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1920
1920
|
* Tag
|
|
1921
1921
|
*
|
|
1922
1922
|
*/
|
|
1923
|
-
|
|
1924
|
-
override async
|
|
1925
|
-
|
|
1923
|
+
|
|
1924
|
+
override async tagContactTagAdd (
|
|
1925
|
+
tagGroupId: string | undefined,
|
|
1926
|
+
tagId: string,
|
|
1926
1927
|
contactId: string,
|
|
1927
1928
|
): Promise<void> {
|
|
1928
|
-
log.verbose('PuppetService', '
|
|
1929
|
+
log.verbose('PuppetService', 'tagContactTagAdd(%s, %s, %s)', tagGroupId, tagId, contactId)
|
|
1929
1930
|
|
|
1930
|
-
const request = new grpcPuppet.
|
|
1931
|
-
|
|
1931
|
+
const request = new grpcPuppet.TagContactTagAddRequest()
|
|
1932
|
+
|
|
1933
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
1934
|
+
request.setTagGroupId(tagGroupId)
|
|
1935
|
+
}
|
|
1936
|
+
request.setTagId(tagId)
|
|
1932
1937
|
request.setContactId(contactId)
|
|
1933
1938
|
|
|
1934
1939
|
await util.promisify(
|
|
1935
|
-
this.grpcManager.client.
|
|
1940
|
+
this.grpcManager.client.tagContactTagAdd
|
|
1936
1941
|
.bind(this.grpcManager.client),
|
|
1937
1942
|
)(request)
|
|
1938
1943
|
}
|
|
1939
1944
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1945
|
+
override async tagContactTagRemove (
|
|
1946
|
+
tagGroupId: string | undefined,
|
|
1947
|
+
tagId: string,
|
|
1943
1948
|
contactId: string,
|
|
1944
|
-
)
|
|
1945
|
-
log.verbose('PuppetService', '
|
|
1949
|
+
): Promise<void> {
|
|
1950
|
+
log.verbose('PuppetService', 'tagContactTagRemove(%s, %s, %s)', tagGroupId, tagId, contactId)
|
|
1946
1951
|
|
|
1947
|
-
const request = new grpcPuppet.
|
|
1948
|
-
|
|
1952
|
+
const request = new grpcPuppet.TagContactTagRemoveRequest()
|
|
1953
|
+
|
|
1954
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
1955
|
+
request.setTagGroupId(tagGroupId)
|
|
1956
|
+
}
|
|
1957
|
+
request.setTagId(tagId)
|
|
1949
1958
|
request.setContactId(contactId)
|
|
1950
1959
|
|
|
1951
1960
|
await util.promisify(
|
|
1952
|
-
this.grpcManager.client.
|
|
1961
|
+
this.grpcManager.client.tagContactTagRemove
|
|
1953
1962
|
.bind(this.grpcManager.client),
|
|
1954
1963
|
)(request)
|
|
1955
1964
|
}
|
|
1956
1965
|
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
log.verbose('PuppetService', 'tagContactDelete(%s)', id)
|
|
1966
|
+
override async tagGroupAdd (
|
|
1967
|
+
tagGroupName: string,
|
|
1968
|
+
): Promise<PUPPET.payloads.TagGroup | void> {
|
|
1969
|
+
log.verbose('PuppetService', 'tagGroupAdd(%s)', tagGroupName)
|
|
1962
1970
|
|
|
1963
|
-
const request = new grpcPuppet.
|
|
1964
|
-
|
|
1971
|
+
const request = new grpcPuppet.TagGroupAddRequest()
|
|
1972
|
+
|
|
1973
|
+
request.setTagGroupName(tagGroupName)
|
|
1974
|
+
|
|
1975
|
+
const result = await util.promisify(
|
|
1976
|
+
this.grpcManager.client.tagGroupAdd
|
|
1977
|
+
.bind(this.grpcManager.client),
|
|
1978
|
+
)(request)
|
|
1979
|
+
|
|
1980
|
+
const grpcPayload = result.getPayload()
|
|
1981
|
+
const id = grpcPayload?.getId()
|
|
1982
|
+
const name = grpcPayload?.getName()
|
|
1983
|
+
|
|
1984
|
+
if (id && name) {
|
|
1985
|
+
const payload: PUPPET.payloads.TagGroup = {
|
|
1986
|
+
id,
|
|
1987
|
+
name,
|
|
1988
|
+
}
|
|
1989
|
+
return payload
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
override async tagGroupDelete (
|
|
1995
|
+
tagGroupId: string,
|
|
1996
|
+
): Promise<void> {
|
|
1997
|
+
log.verbose('PuppetService', 'tagGroupDelete(%s)', tagGroupId)
|
|
1998
|
+
|
|
1999
|
+
const request = new grpcPuppet.TagGroupDeleteRequest()
|
|
2000
|
+
|
|
2001
|
+
request.setTagGroupId(tagGroupId)
|
|
1965
2002
|
|
|
1966
2003
|
await util.promisify(
|
|
1967
|
-
this.grpcManager.client.
|
|
2004
|
+
this.grpcManager.client.tagGroupDelete
|
|
1968
2005
|
.bind(this.grpcManager.client),
|
|
1969
2006
|
)(request)
|
|
2007
|
+
|
|
1970
2008
|
}
|
|
1971
2009
|
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
)
|
|
1976
|
-
log.verbose('PuppetService', '
|
|
2010
|
+
override async tagTagAdd (
|
|
2011
|
+
tagGroupId: string | undefined,
|
|
2012
|
+
tagName: string,
|
|
2013
|
+
): Promise<PUPPET.payloads.Tag | void> {
|
|
2014
|
+
log.verbose('PuppetService', 'tagTagAdd(%s, %s)', tagGroupId, tagName)
|
|
1977
2015
|
|
|
1978
|
-
const request = new grpcPuppet.
|
|
2016
|
+
const request = new grpcPuppet.TagTagAddRequest()
|
|
1979
2017
|
|
|
1980
|
-
if (typeof
|
|
1981
|
-
request.
|
|
1982
|
-
|
|
2018
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
2019
|
+
request.setTagGroupId(tagGroupId)
|
|
2020
|
+
}
|
|
2021
|
+
request.setTagName(tagName)
|
|
1983
2022
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2023
|
+
const result = await util.promisify(
|
|
2024
|
+
this.grpcManager.client.tagTagAdd
|
|
2025
|
+
.bind(this.grpcManager.client),
|
|
2026
|
+
)(request)
|
|
2027
|
+
|
|
2028
|
+
const grpcPayload = result.getPayload()
|
|
2029
|
+
const id = grpcPayload?.getId()
|
|
2030
|
+
const name = grpcPayload?.getName()
|
|
2031
|
+
const groupId = grpcPayload?.getGroupId()
|
|
2032
|
+
const type = grpcPayload?.getType()
|
|
2033
|
+
|
|
2034
|
+
if (id && name && (typeof type !== 'undefined')) {
|
|
2035
|
+
const payload: PUPPET.payloads.Tag = {
|
|
2036
|
+
id,
|
|
2037
|
+
name,
|
|
2038
|
+
groupId,
|
|
2039
|
+
type,
|
|
1990
2040
|
}
|
|
2041
|
+
return payload
|
|
1991
2042
|
}
|
|
1992
2043
|
|
|
1993
|
-
|
|
1994
|
-
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
override async tagTagDelete (
|
|
2047
|
+
tagGroupId: string | undefined,
|
|
2048
|
+
tagId: string,
|
|
2049
|
+
): Promise<void> {
|
|
2050
|
+
log.verbose('PuppetService', 'tagTagDelete(%s, %s)', tagGroupId, tagId)
|
|
2051
|
+
|
|
2052
|
+
const request = new grpcPuppet.TagTagDeleteRequest()
|
|
2053
|
+
|
|
2054
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
2055
|
+
request.setTagGroupId(tagGroupId)
|
|
2056
|
+
}
|
|
2057
|
+
request.setTagId(tagId)
|
|
2058
|
+
|
|
2059
|
+
await util.promisify(
|
|
2060
|
+
this.grpcManager.client.tagTagDelete
|
|
1995
2061
|
.bind(this.grpcManager.client),
|
|
1996
2062
|
)(request)
|
|
1997
2063
|
|
|
1998
|
-
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
override async tagGroupList (): Promise<PUPPET.payloads.TagGroup[]> {
|
|
2067
|
+
log.verbose('PuppetService', 'tagGroupList()')
|
|
2068
|
+
|
|
2069
|
+
const request = new grpcPuppet.TagGroupListRequest()
|
|
2070
|
+
|
|
2071
|
+
const result = await util.promisify(
|
|
2072
|
+
this.grpcManager.client.tagGroupList
|
|
2073
|
+
.bind(this.grpcManager.client),
|
|
2074
|
+
)(request)
|
|
2075
|
+
|
|
2076
|
+
const grpcPayloads = result.getPayloadsList()
|
|
2077
|
+
const payloads: PUPPET.payloads.TagGroup[] = grpcPayloads.map(payload => {
|
|
2078
|
+
return {
|
|
2079
|
+
id: payload.getId(),
|
|
2080
|
+
name: payload.getName(),
|
|
2081
|
+
} as PUPPET.payloads.TagGroup
|
|
2082
|
+
})
|
|
2083
|
+
return payloads
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
override async tagGroupTagList (
|
|
2087
|
+
tagGroupId: string | undefined,
|
|
2088
|
+
): Promise<PUPPET.payloads.Tag[]> {
|
|
2089
|
+
log.verbose('PuppetService', 'tagGroupTagList(%s)', tagGroupId)
|
|
2090
|
+
|
|
2091
|
+
const request = new grpcPuppet.TagGroupTagListRequest()
|
|
2092
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
2093
|
+
request.setTagGroupId(tagGroupId)
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
const result = await util.promisify(
|
|
2097
|
+
this.grpcManager.client.tagGroupTagList
|
|
2098
|
+
.bind(this.grpcManager.client),
|
|
2099
|
+
)(request)
|
|
2100
|
+
|
|
2101
|
+
const grpcPayloads = result.getPayloadsList()
|
|
2102
|
+
const payloads: PUPPET.payloads.Tag[] = grpcPayloads.map(payload => {
|
|
2103
|
+
return {
|
|
2104
|
+
id: payload.getId(),
|
|
2105
|
+
name: payload.getName(),
|
|
2106
|
+
groupId: payload.getGroupId(),
|
|
2107
|
+
type: payload.getType(),
|
|
2108
|
+
} as PUPPET.payloads.Tag
|
|
2109
|
+
})
|
|
2110
|
+
return payloads
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
override async tagTagList (
|
|
2114
|
+
): Promise<PUPPET.payloads.Tag[]> {
|
|
2115
|
+
log.verbose('PuppetService', 'tagTagList()')
|
|
2116
|
+
|
|
2117
|
+
const request = new grpcPuppet.TagTagListRequest()
|
|
2118
|
+
|
|
2119
|
+
const result = await util.promisify(
|
|
2120
|
+
this.grpcManager.client.tagTagList
|
|
2121
|
+
.bind(this.grpcManager.client),
|
|
2122
|
+
)(request)
|
|
2123
|
+
|
|
2124
|
+
const grpcPayloads = result.getPayloadsList()
|
|
2125
|
+
const payloads: PUPPET.payloads.Tag[] = grpcPayloads.map(payload => {
|
|
2126
|
+
return {
|
|
2127
|
+
id: payload.getId(),
|
|
2128
|
+
name: payload.getName(),
|
|
2129
|
+
groupId: payload.getGroupId(),
|
|
2130
|
+
type: payload.getType(),
|
|
2131
|
+
} as PUPPET.payloads.Tag
|
|
2132
|
+
})
|
|
2133
|
+
return payloads
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
override async tagContactTagList (
|
|
2137
|
+
contactId: string,
|
|
2138
|
+
): Promise<PUPPET.payloads.Tag[]> {
|
|
2139
|
+
log.verbose('PuppetService', 'tagContactTagList(%s)', contactId)
|
|
2140
|
+
|
|
2141
|
+
const request = new grpcPuppet.TagContactTagListRequest()
|
|
2142
|
+
request.setContactId(contactId)
|
|
2143
|
+
|
|
2144
|
+
const result = await util.promisify(
|
|
2145
|
+
this.grpcManager.client.tagContactTagList
|
|
2146
|
+
.bind(this.grpcManager.client),
|
|
2147
|
+
)(request)
|
|
2148
|
+
|
|
2149
|
+
const grpcPayloads = result.getPayloadsList()
|
|
2150
|
+
const payloads: PUPPET.payloads.Tag[] = grpcPayloads.map(payload => {
|
|
2151
|
+
return {
|
|
2152
|
+
id: payload.getId(),
|
|
2153
|
+
name: payload.getName(),
|
|
2154
|
+
groupId: payload.getGroupId(),
|
|
2155
|
+
type: payload.getType(),
|
|
2156
|
+
} as PUPPET.payloads.Tag
|
|
2157
|
+
})
|
|
2158
|
+
return payloads
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
override async tagTagContactList (
|
|
2162
|
+
tagGroupId: string | undefined,
|
|
2163
|
+
tagId: string,
|
|
2164
|
+
): Promise<string[]> {
|
|
2165
|
+
log.verbose('PuppetService', 'tagTagContactList(%s, %s)', tagGroupId, tagId)
|
|
2166
|
+
|
|
2167
|
+
const request = new grpcPuppet.TagTagContactListRequest()
|
|
2168
|
+
if (typeof tagGroupId !== 'undefined') {
|
|
2169
|
+
request.setTagGroupId(tagGroupId)
|
|
2170
|
+
}
|
|
2171
|
+
request.setTagId(tagId)
|
|
2172
|
+
|
|
2173
|
+
const result = await util.promisify(
|
|
2174
|
+
this.grpcManager.client.tagTagContactList
|
|
2175
|
+
.bind(this.grpcManager.client),
|
|
2176
|
+
)(request)
|
|
2177
|
+
|
|
2178
|
+
const payloads = result.getPayloadsList()
|
|
2179
|
+
return payloads
|
|
1999
2180
|
}
|
|
2000
2181
|
|
|
2001
2182
|
/**
|
package/src/package-json.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { PackageJson } from 'type-fest'
|
|
5
5
|
export const packageJson: PackageJson = {
|
|
6
6
|
"name": "@juzi/wechaty-puppet-service",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.17",
|
|
8
8
|
"description": "Puppet Service for Wechaty",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
@@ -69,10 +69,10 @@ export const packageJson: PackageJson = {
|
|
|
69
69
|
"why-is-node-running": "^2.2.1"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@juzi/wechaty-puppet": "1.0.
|
|
72
|
+
"@juzi/wechaty-puppet": "^1.0.12"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@juzi/wechaty-grpc": "1.0.
|
|
75
|
+
"@juzi/wechaty-grpc": "^1.0.11",
|
|
76
76
|
"clone-class": "^1.1.1",
|
|
77
77
|
"ducks": "^1.0.2",
|
|
78
78
|
"file-box": "^1.5.5",
|
|
@@ -1492,101 +1492,235 @@ function puppetImplementation (
|
|
|
1492
1492
|
}
|
|
1493
1493
|
},
|
|
1494
1494
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1495
|
+
/**
|
|
1496
|
+
*
|
|
1497
|
+
* tag section
|
|
1498
|
+
*
|
|
1499
|
+
*/
|
|
1500
|
+
|
|
1501
|
+
tagContactTagAdd: async (call, callback) => {
|
|
1502
|
+
log.verbose('PuppetServiceImpl', 'tagContactTagAdd()')
|
|
1497
1503
|
|
|
1498
1504
|
try {
|
|
1499
|
-
const
|
|
1505
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1506
|
+
const tagId = call.request.getTagId()
|
|
1500
1507
|
const contactId = call.request.getContactId()
|
|
1501
1508
|
|
|
1502
|
-
await puppet.
|
|
1509
|
+
await puppet.tagContactTagAdd(tagGroupId, tagId, contactId)
|
|
1510
|
+
|
|
1511
|
+
return callback(null, new grpcPuppet.TagContactTagAddResponse())
|
|
1512
|
+
} catch (e) {
|
|
1513
|
+
return grpcError('tagContactTagAdd', e, callback)
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
|
|
1517
|
+
tagContactTagRemove: async (call, callback) => {
|
|
1518
|
+
log.verbose('PuppetServiceImpl', 'tagContactTagRemove()')
|
|
1503
1519
|
|
|
1504
|
-
|
|
1520
|
+
try {
|
|
1521
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1522
|
+
const tagId = call.request.getTagId()
|
|
1523
|
+
const contactId = call.request.getContactId()
|
|
1505
1524
|
|
|
1525
|
+
await puppet.tagContactTagRemove(tagGroupId, tagId, contactId)
|
|
1526
|
+
|
|
1527
|
+
return callback(null, new grpcPuppet.TagContactTagRemoveResponse())
|
|
1506
1528
|
} catch (e) {
|
|
1507
|
-
return grpcError('
|
|
1529
|
+
return grpcError('tagContactTagRemove', e, callback)
|
|
1508
1530
|
}
|
|
1509
1531
|
},
|
|
1510
1532
|
|
|
1511
|
-
|
|
1512
|
-
log.verbose('PuppetServiceImpl', '
|
|
1533
|
+
tagGroupAdd: async (call, callback) => {
|
|
1534
|
+
log.verbose('PuppetServiceImpl', 'tagGroupAdd()')
|
|
1513
1535
|
|
|
1514
1536
|
try {
|
|
1515
|
-
const
|
|
1537
|
+
const tagGroupName = call.request.getTagGroupName()
|
|
1516
1538
|
|
|
1517
|
-
await puppet.
|
|
1539
|
+
const result = await puppet.tagGroupAdd(tagGroupName)
|
|
1540
|
+
const payload = new grpcPuppet.TagGroupPayload()
|
|
1541
|
+
const response = new grpcPuppet.TagGroupAddResponse()
|
|
1518
1542
|
|
|
1519
|
-
|
|
1543
|
+
if (result) {
|
|
1544
|
+
payload.setId(result.id)
|
|
1545
|
+
payload.setName(result.name)
|
|
1546
|
+
response.setPayload(payload)
|
|
1547
|
+
}
|
|
1520
1548
|
|
|
1549
|
+
return callback(null, response)
|
|
1521
1550
|
} catch (e) {
|
|
1522
|
-
return grpcError('
|
|
1551
|
+
return grpcError('tagGroupAdd', e, callback)
|
|
1523
1552
|
}
|
|
1524
1553
|
},
|
|
1525
1554
|
|
|
1526
|
-
|
|
1527
|
-
log.verbose('PuppetServiceImpl', '
|
|
1555
|
+
tagGroupDelete: async (call, callback) => {
|
|
1556
|
+
log.verbose('PuppetServiceImpl', 'tagGroupDelete()')
|
|
1528
1557
|
|
|
1529
1558
|
try {
|
|
1530
|
-
const
|
|
1559
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1531
1560
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1561
|
+
await puppet.tagGroupDelete(tagGroupId)
|
|
1562
|
+
|
|
1563
|
+
return callback(null, new grpcPuppet.TagGroupDeleteResponse())
|
|
1564
|
+
} catch (e) {
|
|
1565
|
+
return grpcError('tagGroupDelete', e, callback)
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1537
1568
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1569
|
+
tagTagAdd: async (call, callback) => {
|
|
1570
|
+
log.verbose('PuppetServiceImpl', 'tagTagAdd()')
|
|
1540
1571
|
|
|
1541
|
-
|
|
1572
|
+
try {
|
|
1573
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1574
|
+
const tagName = call.request.getTagName()
|
|
1575
|
+
|
|
1576
|
+
const result = await puppet.tagTagAdd(tagGroupId, tagName)
|
|
1577
|
+
const payload = new grpcPuppet.TagPayload()
|
|
1578
|
+
const response = new grpcPuppet.TagTagAddResponse()
|
|
1579
|
+
|
|
1580
|
+
if (result) {
|
|
1581
|
+
payload.setId(result.id)
|
|
1582
|
+
payload.setName(result.name)
|
|
1583
|
+
payload.setType(result.type)
|
|
1584
|
+
if (result.groupId) {
|
|
1585
|
+
payload.setGroupId(result.groupId)
|
|
1586
|
+
}
|
|
1587
|
+
response.setPayload(payload)
|
|
1542
1588
|
}
|
|
1543
1589
|
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1590
|
+
return callback(null, response)
|
|
1591
|
+
} catch (e) {
|
|
1592
|
+
return grpcError('tagTagAdd', e, callback)
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1549
1595
|
|
|
1550
|
-
|
|
1551
|
-
|
|
1596
|
+
tagTagDelete: async (call, callback) => {
|
|
1597
|
+
log.verbose('PuppetServiceImpl', 'tagTagDelete()')
|
|
1552
1598
|
|
|
1553
|
-
|
|
1599
|
+
try {
|
|
1600
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1601
|
+
const tagId = call.request.getTagId()
|
|
1554
1602
|
|
|
1555
|
-
|
|
1556
|
-
response.setIdsList(tagIdList)
|
|
1603
|
+
await puppet.tagTagDelete(tagGroupId, tagId)
|
|
1557
1604
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1605
|
+
return callback(null, new grpcPuppet.TagTagDeleteResponse())
|
|
1606
|
+
} catch (e) {
|
|
1607
|
+
return grpcError('tagTagDelete', e, callback)
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1561
1610
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
const tagIdList = await puppet.tagContactList()
|
|
1611
|
+
tagGroupList: async (call, callback) => {
|
|
1612
|
+
log.verbose('PuppetServiceImpl', 'tagGroupList()')
|
|
1613
|
+
void call
|
|
1566
1614
|
|
|
1567
|
-
|
|
1568
|
-
|
|
1615
|
+
try {
|
|
1616
|
+
const result = await puppet.tagGroupList()
|
|
1617
|
+
const payloads = result.map(tagGroup => {
|
|
1618
|
+
const payload = new grpcPuppet.TagGroupPayload()
|
|
1619
|
+
payload.setId(tagGroup.id)
|
|
1620
|
+
payload.setName(tagGroup.name)
|
|
1621
|
+
return payload
|
|
1622
|
+
})
|
|
1623
|
+
const response = new grpcPuppet.TagGroupListResponse()
|
|
1624
|
+
response.setPayloadsList(payloads)
|
|
1569
1625
|
|
|
1570
1626
|
return callback(null, response)
|
|
1627
|
+
} catch (e) {
|
|
1628
|
+
return grpcError('tagGroupList', e, callback)
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
|
|
1632
|
+
tagGroupTagList: async (call, callback) => {
|
|
1633
|
+
log.verbose('PuppetServiceImpl', 'tagGroupTagList()')
|
|
1634
|
+
|
|
1635
|
+
try {
|
|
1636
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1637
|
+
|
|
1638
|
+
const result = await puppet.tagGroupTagList(tagGroupId)
|
|
1639
|
+
const payloads = result.map(tag => {
|
|
1640
|
+
const payload = new grpcPuppet.TagPayload()
|
|
1641
|
+
payload.setId(tag.id)
|
|
1642
|
+
payload.setName(tag.name)
|
|
1643
|
+
payload.setType(tag.type)
|
|
1644
|
+
if (tag.groupId) {
|
|
1645
|
+
payload.setGroupId(tag.groupId)
|
|
1646
|
+
}
|
|
1647
|
+
return payload
|
|
1648
|
+
})
|
|
1649
|
+
const response = new grpcPuppet.TagGroupTagListResponse()
|
|
1650
|
+
response.setPayloadsList(payloads)
|
|
1651
|
+
|
|
1652
|
+
return callback(null, response)
|
|
1653
|
+
} catch (e) {
|
|
1654
|
+
return grpcError('tagTagList', e, callback)
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1571
1657
|
|
|
1658
|
+
tagTagList: async (call, callback) => {
|
|
1659
|
+
log.verbose('PuppetServiceImpl', 'tagTagList()')
|
|
1660
|
+
void call
|
|
1661
|
+
|
|
1662
|
+
try {
|
|
1663
|
+
const result = await puppet.tagTagList()
|
|
1664
|
+
const payloads = result.map(tag => {
|
|
1665
|
+
const payload = new grpcPuppet.TagPayload()
|
|
1666
|
+
payload.setId(tag.id)
|
|
1667
|
+
payload.setName(tag.name)
|
|
1668
|
+
payload.setType(tag.type)
|
|
1669
|
+
if (tag.groupId) {
|
|
1670
|
+
payload.setGroupId(tag.groupId)
|
|
1671
|
+
}
|
|
1672
|
+
return payload
|
|
1673
|
+
})
|
|
1674
|
+
const response = new grpcPuppet.TagTagListResponse()
|
|
1675
|
+
response.setPayloadsList(payloads)
|
|
1676
|
+
|
|
1677
|
+
return callback(null, response)
|
|
1572
1678
|
} catch (e) {
|
|
1573
|
-
return grpcError('
|
|
1679
|
+
return grpcError('tagTagList', e, callback)
|
|
1574
1680
|
}
|
|
1575
1681
|
},
|
|
1576
1682
|
|
|
1577
|
-
|
|
1578
|
-
log.verbose('PuppetServiceImpl', '
|
|
1683
|
+
tagContactTagList: async (call, callback) => {
|
|
1684
|
+
log.verbose('PuppetServiceImpl', 'tagContactTagList()')
|
|
1579
1685
|
|
|
1580
1686
|
try {
|
|
1581
|
-
const tagId = call.request.getId()
|
|
1582
1687
|
const contactId = call.request.getContactId()
|
|
1583
1688
|
|
|
1584
|
-
await puppet.
|
|
1689
|
+
const result = await puppet.tagContactTagList(contactId)
|
|
1690
|
+
const payloads = result.map(tag => {
|
|
1691
|
+
const payload = new grpcPuppet.TagPayload()
|
|
1692
|
+
payload.setId(tag.id)
|
|
1693
|
+
payload.setName(tag.name)
|
|
1694
|
+
payload.setType(tag.type)
|
|
1695
|
+
if (tag.groupId) {
|
|
1696
|
+
payload.setGroupId(tag.groupId)
|
|
1697
|
+
}
|
|
1698
|
+
return payload
|
|
1699
|
+
})
|
|
1700
|
+
const response = new grpcPuppet.TagContactTagListResponse()
|
|
1701
|
+
response.setPayloadsList(payloads)
|
|
1585
1702
|
|
|
1586
|
-
return callback(null,
|
|
1703
|
+
return callback(null, response)
|
|
1704
|
+
} catch (e) {
|
|
1705
|
+
return grpcError('tagContactTagList', e, callback)
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
|
|
1709
|
+
tagTagContactList: async (call, callback) => {
|
|
1710
|
+
log.verbose('PuppetServiceImpl', 'tagTagContactList()')
|
|
1711
|
+
|
|
1712
|
+
try {
|
|
1713
|
+
const tagGroupId = call.request.getTagGroupId()
|
|
1714
|
+
const tagId = call.request.getTagId()
|
|
1715
|
+
|
|
1716
|
+
const result = await puppet.tagTagContactList(tagGroupId, tagId)
|
|
1587
1717
|
|
|
1718
|
+
const response = new grpcPuppet.TagTagContactListResponse()
|
|
1719
|
+
response.setPayloadsList(result)
|
|
1720
|
+
|
|
1721
|
+
return callback(null, response)
|
|
1588
1722
|
} catch (e) {
|
|
1589
|
-
return grpcError('
|
|
1723
|
+
return grpcError('tagTagContactList', e, callback)
|
|
1590
1724
|
}
|
|
1591
1725
|
},
|
|
1592
1726
|
|