Skip to content

Commit

Permalink
subscription()/parseSubscription [fixup]
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jan 13, 2022
1 parent 402654d commit caaf72d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,7 @@ const createClient = (profile, userAgent, opt = {}) => {
})
const ctx = {profile, opt, common, res}

const {details} = res
return {
subscription: profile.parseSubscription(ctx, subscriptionId, details.conSubscr),
// todo: parse & give a proper name
rtEvents: details.eventHistory && details.eventHistory.rtEvents || [],
himEvents: details.eventHistory && details.eventHistory.himEvents || [],
}
return profile.parseSubscription(ctx, res.details)
}

const subscribeToJourney = async (userId, channelIds, journeyRefreshToken, opt = {}) => {
Expand Down
12 changes: 10 additions & 2 deletions parse/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

const {gunzipSync} = require('zlib')

const parseSubscription = (ctx, id, s) => {
const parseSubscription = (ctx, _) => {
const {profile, opt} = ctx
const s = _.conSubscr

const res = {
id,
id: _.subscrId,
status: _.status,
// todo: _.channels

// todo: parse & give a proper name
rtEvents: _.eventHistory && _.eventHistory.rtEvents || [],
himEvents: _.eventHistory && _.eventHistory.himEvents || [],

hysteresis: s.hysteresis,
monitorFlags: s.monitorFlags,
connectionInfo: s.connectionInfo,
Expand Down

0 comments on commit caaf72d

Please sign in to comment.