Skip to content

Commit

Permalink
Prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreif committed Aug 19, 2023
1 parent 9abc50b commit 52b7706
Show file tree
Hide file tree
Showing 49 changed files with 365 additions and 333 deletions.
6 changes: 3 additions & 3 deletions packages/examples/api-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ async function example() {
})
console.log('Got events', eventsResponse.events[0])
const eventsWithRecordings = eventsResponse.events.filter(
(event) => event.recording_status === 'ready'
(event) => event.recording_status === 'ready',
),
transcodedUrl = await camera.getRecordingUrl(
eventsWithRecordings[0].ding_id_str, // MUST use the ding_id_str, not ding_id
{
transcoded: true, // get transcoded version of the video. false by default. transcoded has ring log and timestamp
}
},
),
untranscodedUrl = await camera.getRecordingUrl(
eventsWithRecordings[0].ding_id_str
eventsWithRecordings[0].ding_id_str,
)

console.log('Recording Transcoded URL', transcodedUrl)
Expand Down
13 changes: 8 additions & 5 deletions packages/examples/browser-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function example() {
app.use('/', express.static(path.join(__dirname, 'public')))
app.listen(3000, () => {
console.log(
'Listening on port 3000. Go to http://localhost:3000 in your browser'
'Listening on port 3000. Go to http://localhost:3000 in your browser',
)
})

Expand Down Expand Up @@ -62,10 +62,13 @@ async function example() {
process.exit()
})

setTimeout(function () {
console.log('Stopping call...')
call.stop()
}, 5 * 60 * 1000) // Stop after 5 minutes.
setTimeout(
function () {
console.log('Stopping call...')
call.stop()
},
5 * 60 * 1000,
) // Stop after 5 minutes.
}

example().catch((e) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function example() {
allCameras = await ringApi.getCameras()

console.log(
`Found ${locations.length} location(s) with ${allCameras.length} camera(s).`
`Found ${locations.length} location(s) with ${allCameras.length} camera(s).`,
)

ringApi.onRefreshTokenUpdated.subscribe(
Expand All @@ -32,7 +32,7 @@ async function example() {
.replace(oldRefreshToken, newRefreshToken)

await promisify(writeFile)('.env', updatedConfig)
}
},
)

for (const location of locations) {
Expand All @@ -47,15 +47,15 @@ async function example() {
devices = await location.getDevices()

console.log(
`\nLocation ${location.name} (${location.id}) has the following ${cameras.length} camera(s):`
`\nLocation ${location.name} (${location.id}) has the following ${cameras.length} camera(s):`,
)

for (const camera of cameras) {
console.log(`- ${camera.id}: ${camera.name} (${camera.deviceType})`)
}

console.log(
`\nLocation ${location.name} (${location.id}) has the following ${devices.length} device(s):`
`\nLocation ${location.name} (${location.id}) has the following ${devices.length} device(s):`,
)

for (const device of devices) {
Expand All @@ -76,7 +76,7 @@ async function example() {
console.log(
`${event} on ${camera.name} camera. Ding id ${
notification.ding.id
}. Received at ${new Date()}`
}. Received at ${new Date()}`,
)
})
})
Expand Down
14 changes: 7 additions & 7 deletions packages/homebridge-ring/base-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { logError, logInfo } from 'ring-client-api/util'

function isServiceInstance(
serviceType: WithUUID<typeof Service> | Service
serviceType: WithUUID<typeof Service> | Service,
): serviceType is Service {
return typeof (serviceType as any) === 'object'
}
Expand All @@ -36,7 +36,7 @@ export abstract class BaseAccessory<T extends { name: string }> {
getService(
serviceType: ServiceType,
name = this.device.name,
subType?: string
subType?: string,
) {
if (isServiceInstance(serviceType)) {
return serviceType
Expand All @@ -60,7 +60,7 @@ export abstract class BaseAccessory<T extends { name: string }> {
name !== existingService.displayName
) {
throw new Error(
`Overlapping services for device ${this.device.name} - ${name} != ${existingService.displayName} - ${serviceType}`
`Overlapping services for device ${this.device.name} - ${name} != ${existingService.displayName} - ${serviceType}`,
)
}

Expand Down Expand Up @@ -110,7 +110,7 @@ export abstract class BaseAccessory<T extends { name: string }> {
} catch (e: any) {
callback(e)
}
}
},
)
})
}
Expand All @@ -120,13 +120,13 @@ export abstract class BaseAccessory<T extends { name: string }> {
CharacteristicEventTypes.SET,
(
newValue: CharacteristicValue,
callback: CharacteristicSetCallback
callback: CharacteristicSetCallback,
) => {
Promise.resolve(setValue(newValue as U)).catch((e) => {
logError(e)
})
callback()
}
},
)
}
}
Expand All @@ -147,7 +147,7 @@ export abstract class BaseAccessory<T extends { name: string }> {
service.UUID,
service.displayName || service.name,
'from',
this.device.name
this.device.name,
)

this.accessory.removeService(service)
Expand Down
12 changes: 6 additions & 6 deletions packages/homebridge-ring/base-data-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { logError } from 'ring-client-api/util'

export abstract class BaseDataAccessory<
T extends RingDevice | RingCamera | RingChime | RingIntercom
T extends RingDevice | RingCamera | RingChime | RingIntercom,
> extends BaseAccessory<T> {
abstract readonly device: T
abstract readonly accessory: PlatformAccessory
Expand Down Expand Up @@ -63,7 +63,7 @@ export abstract class BaseDataAccessory<
} catch (e: any) {
callback(e)
}
}
},
)
}

Expand All @@ -74,11 +74,11 @@ export abstract class BaseDataAccessory<
CharacteristicEventTypes.SET,
(
newValue: CharacteristicValue,
callback: CharacteristicSetCallback
callback: CharacteristicSetCallback,
) => {
onValueToSet.next(newValue)
callback()
}
},
)

onValueToSet.pipe(debounceTime(setValueDebounceTime)).subscribe(setValue)
Expand All @@ -87,11 +87,11 @@ export abstract class BaseDataAccessory<
CharacteristicEventTypes.SET,
(
newValue: CharacteristicValue,
callback: CharacteristicSetCallback
callback: CharacteristicSetCallback,
) => {
Promise.resolve(setValue(newValue)).catch(logError)
callback()
}
},
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/homebridge-ring/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Beam extends BaseDeviceAccessory {
constructor(
public readonly device: RingDevice,
public readonly accessory: PlatformAccessory,
public readonly config: RingPlatformConfig
public readonly config: RingPlatformConfig,
) {
super()

Expand Down
2 changes: 1 addition & 1 deletion packages/homebridge-ring/brightness-only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class BrightnessOnly extends BaseDeviceAccessory {
constructor(
public readonly device: RingDevice,
public readonly accessory: PlatformAccessory,
public readonly config: RingPlatformConfig
public readonly config: RingPlatformConfig,
) {
super()

Expand Down
Loading

0 comments on commit 52b7706

Please sign in to comment.