From 40cd032787887fc69b9af5710868d6cd1c7585af Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Sat, 30 Mar 2024 17:46:05 +0100 Subject: [PATCH] Code refresh (#188) * fix: AudioClip notification without websockets * chore: textual changes to templates * chore: Workflow updates * chore: Docs update --- .devcontainer/devcontainer.json | 22 +++ .generator/ts/service-export.hbs | 2 +- .generator/ts/service.hbs | 20 +- .generator/ts/sonos-base.hbs | 9 +- .generator/ts/sonos-upnp-errors.hbs | 2 +- .generator/ts/template.json | 2 +- .github/ISSUE_TEMPLATE/config.yml | 11 +- .github/dependabot.yml | 12 ++ .github/workflows/codeql-analysis.yml | 8 +- .github/workflows/test-and-release.yml | 18 +- README.md | 19 +- docs/index.md | 14 +- .../services/alarm-clock-service.md | 2 +- .../services/av-transport-service.md | 4 +- .../services/connection-manager-service.md | 2 +- .../services/content-directory-service.md | 14 +- .../services/device-properties-service.md | 18 +- .../services/group-management-service.md | 2 +- .../group-rendering-control-service.md | 2 +- .../services/music-services-service.md | 2 +- docs/sonos-device/services/q-play-service.md | 2 +- docs/sonos-device/services/queue-service.md | 2 +- .../services/rendering-control-service.md | 2 +- docs/sonos-device/services/services.md | 2 +- .../services/system-properties-service.md | 2 +- .../services/virtual-line-in-service.md | 2 +- .../services/zone-group-topology-service.md | 2 +- examples/play-notification-audioclip.js | 13 +- package.json | 8 +- src/services/alarm-clock.service.ts | 70 +++---- src/services/audio-in.service.ts | 30 +-- src/services/av-transport.service.ts | 172 +++++++++--------- src/services/connection-manager.service.ts | 14 +- src/services/content-directory.service.ts | 80 ++++---- src/services/device-properties.service.ts | 130 +++++++------ src/services/group-management.service.ts | 18 +- .../group-rendering-control.service.ts | 26 +-- src/services/ht-control.service.ts | 34 ++-- src/services/index.ts | 2 +- src/services/music-services.service.ts | 14 +- src/services/q-play.service.ts | 6 +- src/services/queue.service.ts | 46 ++--- src/services/rendering-control.service.ts | 114 ++++++------ src/services/sonos-upnp-errors.ts | 2 +- src/services/system-properties.service.ts | 70 +++---- src/services/virtual-line-in.service.ts | 34 ++-- src/services/zone-group-topology.service.ts | 34 ++-- src/sonos-device-base.ts | 4 +- src/sonos-device.ts | 46 +++-- 49 files changed, 612 insertions(+), 554 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fe1dc37 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Node.js & TypeScript", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bookworm", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "npm install", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.generator/ts/service-export.hbs b/.generator/ts/service-export.hbs index 9b1019c..f149d54 100644 --- a/.generator/ts/service-export.hbs +++ b/.generator/ts/service-export.hbs @@ -2,7 +2,7 @@ * All sonos services exported as one file for easy access. * * Stephan van Rooij - * https://svrooij.io/sonos-api-docs + * https://sonos.svrooij.io/ * * This file is generated, do not edit manually. */ diff --git a/.generator/ts/service.hbs b/.generator/ts/service.hbs index d59728f..71965da 100644 --- a/.generator/ts/service.hbs +++ b/.generator/ts/service.hbs @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ {{#if data.importUrl}} import { URL } from 'url'; @@ -70,18 +70,18 @@ export class {{serviceName}}{{#if data.extended}}Base{{/if}} extends BaseService */ {{/if}} {{#if inputs}} - async {{name}}(input: { {{#each inputs}}{{name}}: {{relatedStateVariable.dataType}}{{#unless @last}}; {{/unless}}{{/each}} }{{{sonos_if_only_instance_id inputs ' = { InstanceID: 0 }'}}}): + {{name}}(input: { {{#each inputs}}{{name}}: {{relatedStateVariable.dataType}}{{#unless @last}}; {{/unless}}{{/each}} }{{{sonos_if_only_instance_id inputs ' = { InstanceID: 0 }'}}}): {{#if outputs}} - Promise<{{name}}Response> { return await this.SoapRequestWithBody('{{name}}', input); } + Promise<{{name}}Response> { return this.SoapRequestWithBody('{{name}}', input); } {{else}} - Promise { return await this.SoapRequestWithBodyNoResponse('{{name}}', input); } + Promise { return this.SoapRequestWithBodyNoResponse('{{name}}', input); } {{/if}} {{else}} - async {{name}}(): + {{name}}(): {{#if outputs}} - Promise<{{name}}Response> { return await this.SoapRequest<{{name}}Response>('{{name}}'); } + Promise<{{name}}Response> { return this.SoapRequest<{{name}}Response>('{{name}}'); } {{else}} - Promise { return await this.SoapRequestNoResponse('{{name}}'); } + Promise { return this.SoapRequestNoResponse('{{name}}'); } {{/if}} {{/if}} {{#unless @last}} @@ -91,7 +91,7 @@ export class {{serviceName}}{{#if data.extended}}Base{{/if}} extends BaseService // #endregion {{#if outputVariables}} - protected responseProperties(): {[key: string]: string} { + protected responseProperties(): { [key: string]: string } { return { {{#each outputVariables}} {{@key}}: '{{{this}}}', @@ -102,7 +102,7 @@ export class {{serviceName}}{{#if data.extended}}Base{{/if}} extends BaseService {{#if eventVariables}} // Event properties from service description. - protected eventProperties(): {[key: string]: string} { + protected eventProperties(): { [key: string]: string } { return { {{#each eventVariables}} {{name}}: '{{#if (or (are_equal name 'Volume') (are_equal name 'Mute'))}}{{#if (are_equal name 'Mute')}}ChannelValue{{else}}ChannelValue{{/if}}{{else}}{{{dataType}}}{{/if}}', @@ -112,7 +112,7 @@ export class {{serviceName}}{{#if data.extended}}Base{{/if}} extends BaseService {{else}} // No properties in service description, throw error on retrieval. - protected eventProperties(): {[key: string]: string} { + protected eventProperties(): { [key: string]: string } { throw new Error('No event properties in service definition'); } {{/if}} diff --git a/.generator/ts/sonos-base.hbs b/.generator/ts/sonos-base.hbs index fdcc29e..80dbb5c 100644 --- a/.generator/ts/sonos-base.hbs +++ b/.generator/ts/sonos-base.hbs @@ -2,13 +2,12 @@ * Sonos base device with all services defined. * * Stephan van Rooij - * https://svrooij.io/sonos-api-docs + * https://sonos.svrooij.io/ * * This file is generated, do not edit manually. */ -import { Guid } from 'guid-typescript'; import debug, { Debugger } from 'debug'; - +import { randomUUID } from 'crypto'; import { {{#each services}} {{name}}Service, {{/each}} @@ -40,10 +39,10 @@ export default class SonosDeviceBase { *Creates an instance of SonosDeviceBase. * @param {string} host The IP of the speaker * @param {number} [port=1400] The port, always 1400 - * @param {string} [uuid=Guid.create().toString()] The UUID of the speaker like RINCON_macaddres01400, used in some commands. + * @param {string} [uuid=crypto.randomUUID().toString()] The UUID of the speaker like RINCON_macaddres01400, used in some commands. * @memberof SonosDeviceBase */ - constructor(host: string, port = 1400, uuid: string = Guid.create().toString()) { + constructor(host: string, port = 1400, uuid: string = randomUUID().toString()) { this.host = host; this.port = port; this.uuid = uuid; diff --git a/.generator/ts/sonos-upnp-errors.hbs b/.generator/ts/sonos-upnp-errors.hbs index 88c4e62..cf44019 100644 --- a/.generator/ts/sonos-upnp-errors.hbs +++ b/.generator/ts/sonos-upnp-errors.hbs @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import { SonosUpnpError } from '../models/sonos-upnp-error'; diff --git a/.generator/ts/template.json b/.generator/ts/template.json index fbae431..4aaefe9 100644 --- a/.generator/ts/template.json +++ b/.generator/ts/template.json @@ -1,5 +1,5 @@ { - "$schema": "https://svrooij.io/sonos-api-docs/schema/template.json", + "$schema": "https://sonos.svrooij.io/schema/template.json", "name": "Sonos Typescript", "slug": "ts", "repository": "https://github.com/svrooij/node-sonos-ts/", diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 0639877..a74eaaa 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ -blank_issues_enabled: true +blank_issues_enabled: false contact_links: - - name: Sonos-ts discourd - url: https://discord.gg/VMtG6Ft36J - about: For quick answers to your questions check out our community. + - name: Documentation + url: https://sonos-ts.svrooij.io/ + about: Have you checked to documentation? + - name: Questions + url: https://github.com/svrooij/node-sonos-ts/discussions/categories/q-a + about: Not sure how something works, ask a question instead of creating an issue. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cd03357..207a919 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,11 +24,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} config-file: ./.github/codeql/codeql-config.yml @@ -36,7 +36,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -50,4 +50,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index fc3d9d6..acb217b 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -24,8 +24,8 @@ jobs: matrix: node: [16, 18] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} @@ -55,12 +55,12 @@ jobs: if: github.event_name != 'pull_request' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Use node 16 - uses: actions/setup-node@v3 + - name: Use node 18 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 - name: Install dependencies run: npm ci @@ -76,7 +76,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Semantic Release - uses: cycjimmy/semantic-release-action@v3 + uses: cycjimmy/semantic-release-action@v4 if: steps.mygate.outputs.inputsChecked == 'true' id: semantic env: @@ -85,9 +85,9 @@ jobs: - name: Setup node for Github Registry if: steps.semantic.outputs.new_release_published == 'true' - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 registry-url: 'https://npm.pkg.github.com' scope: 'svrooij' diff --git a/README.md b/README.md index 23f353d..d221fe2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Sonos2mqtt][badge_sonos-mqtt]][link_sonos-mqtt] [![Sonos cli][badge_sonos-cli]][link_sonos-cli] -[![Join us on Discord][badge_discord]][link_discord] [![Support me on Github][badge_sponsor]][link_sponsor] [![Follow on Twitter][badge_twitter]][link_twitter] @@ -21,7 +20,7 @@ Typescript library to control your Sonos speakers. Can be used in other typescri --- ## Key features -- [x] Auto generated client (supporting all features the normal app does). [Sonos api documentation and generator](https://svrooij.io/sonos-api-docs/) +- [x] Auto generated client (supporting all features the normal app does). [Sonos api documentation and generator][link_sonos-docs] - [x] Auto discovery or one known device as starting point. - [x] Support for logical devices (grouped speakers) from the start. - [x] Access to all (generated) services. @@ -33,11 +32,11 @@ Typescript library to control your Sonos speakers. Can be used in other typescri To use the library just add it to your project. `npm install @svrooij/sonos`. And start using it. This library isn't meant to be used by itself, as you see in the [examples](./examples) you still need to use node (or typescript). -See **[Documentation](https://svrooij.github.io/node-sonos-ts/getting-started.html)** +See **[Documentation](https://sonos-ts.svrooij.io/getting-started.html)** -[![Sonos typescript this library][badge_sonos-typescript]][link_sonos-typescript] [![Join us on Discord][badge_discord]][link_discord] +[![Sonos typescript this library][badge_sonos-typescript]][link_sonos-typescript] -If you need help using this library, [join us on discord][link_discord]. +If you need help using this library, check out the [questions section](https://github.com/svrooij/node-sonos-ts/discussions/categories/q-a) on this repository. ## Use Sonos manager (recommended) @@ -118,6 +117,7 @@ sonos.PlayTTS({ text: 'Someone at the front-door', lang: 'en-US', gender: 'male' |----|----------|----------| |[sonos2mqtt](https://github.com/svrooij/sonos2mqtt)|[@svrooij](https://github.com/svrooij)|A bridge between sonos and mqtt, so you can control all your sonos devices right from your mqtt server| |[sonos-cli](https://github.com/svrooij/sonos-cli)|[@svrooij](https://github.com/svrooij)|An experimental command line interface for your sonos devices.| +|[node-red-contrib-sonos-plus](https://github.com/hklages/node-red-contrib-sonos-plus)|[@hklages](https://github.com/hklages)|A node-red node to control your sonos devices| Also using this library, but not in the list? Send a PR. @@ -127,7 +127,6 @@ Also using this library, but not in the list? Send a PR. [![Sonos2mqtt][badge_sonos-mqtt]][link_sonos-mqtt] [![Sonos cli][badge_sonos-cli]][link_sonos-cli] [![Sonos typescript this library][badge_sonos-typescript]][link_sonos-typescript] -[![Join us on Discord][badge_discord]][link_discord] [![Support me on Github][badge_sponsor]][link_sponsor] [![Follow on Twitter][badge_twitter]][link_twitter] @@ -198,7 +197,6 @@ Creating a library from scratch is quite hard, and I'm using a lot of stuff from [badge_build]: https://img.shields.io/github/actions/workflow/status/svrooij/node-sonos-ts/test-and-release.yml?branch=beta&style=for-the-badge [badge_contrib]: https://img.shields.io/github/all-contributors/svrooij/node-sonos-ts?style=for-the-badge [badge_coverage]: https://img.shields.io/coverallsCoverage/github/svrooij/node-sonos-ts?style=for-the-badge&branch=beta -[badge_discord]: https://img.shields.io/discord/782374564054564875?style=for-the-badge [badge_issues]: https://img.shields.io/github/issues/svrooij/node-sonos-ts?style=for-the-badge [badge_npm]: https://img.shields.io/npm/v/@svrooij/sonos?style=for-the-badge [badge_sonos-cli]: https://img.shields.io/badge/sonos-cli-blue?style=for-the-badge @@ -209,12 +207,11 @@ Creating a library from scratch is quite hard, and I'm using a lot of stuff from [badge_twitter]: https://img.shields.io/twitter/follow/svrooij?logo=twitter&style=for-the-badge [link_build]: https://github.com/svrooij/node-sonos-ts/actions -[link_discord]: https://discord.gg/VMtG6Ft36J [link_issues]: https://github.com/svrooij/node-sonos-ts/issues [link_npm]: https://www.npmjs.com/package/@svrooij/sonos [link_sonos-cli]: https://github.com/svrooij/sonos-cli -[link_sonos-docs]: https://svrooij.io/sonos-api-docs -[link_sonos-mqtt]: https://svrooij.io/sonos2mqtt -[link_sonos-typescript]: https://svrooij.io/node-sonos-ts +[link_sonos-docs]: https://sonos.svrooij.io/ +[link_sonos-mqtt]: https://sonos2mqtt.svrooij.io/ +[link_sonos-typescript]: https://sonos-ts.svrooij.io/ [link_sponsor]: https://github.com/sponsors/svrooij [link_twitter]: https://twitter.com/svrooij \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index f5817f4..6ccb3f4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,7 +15,6 @@ permalink: / [![Sonos cli][badge_sonos-cli]][link_sonos-cli] [![Sonos typescript this library][badge_sonos-typescript]][link_sonos-typescript] -[![Join us on Discord][badge_discord]][link_discord] [![Support me on Github][badge_sponsor]][link_sponsor] [![Follow on Twitter][badge_twitter]][link_twitter] @@ -31,7 +30,7 @@ This library is in no way connected to [Sonos](//en.wikipedia.org/wiki/Sonos). ## Key features -- [x] Auto generated client (supporting all features the normal app does). [Sonos api documentation and generator](https://svrooij.io/sonos-api-docs/) +- [x] Auto generated client (supporting all features the normal app does). [Sonos api documentation and generator][link_sonos-docs] - [x] Auto discovery or one known device as starting point. - [x] Support for logical devices (grouped speakers) from the start. - [x] Access to all (generated) services. @@ -43,10 +42,9 @@ This library is in no way connected to [Sonos](//en.wikipedia.org/wiki/Sonos). To use the library just add it to your project. `npm install @svrooij/sonos`. And start using it. This library isn't meant to be used by itself, as you see in the [examples](https://github.com/svrooij/node-sonos-ts/tree/master/examples) you still need to use node (or typescript). -See **[Documentation](https://svrooij.github.io/node-sonos-ts/getting-started.html)** +See **[Documentation](https://sonos-ts.svrooij.io/getting-started.html)** [![Sonos typescript this library][badge_sonos-typescript]][link_sonos-typescript] -[![Join us on Discord][badge_discord]][link_discord] ## Packages using sonos-ts @@ -95,7 +93,6 @@ specification. Contributions of any kind welcome! [badge_build]: https://img.shields.io/github/actions/workflow/status/svrooij/node-sonos-ts/test-and-release.yml?branch=beta&style=for-the-badge [badge_contrib]: https://img.shields.io/github/all-contributors/svrooij/node-sonos-ts?style=for-the-badge [badge_coverage]: https://img.shields.io/coverallsCoverage/github/svrooij/node-sonos-ts?style=for-the-badge&branch=beta -[badge_discord]: https://img.shields.io/discord/782374564054564875?style=for-the-badge [badge_issues]: https://img.shields.io/github/issues/svrooij/node-sonos-ts?style=for-the-badge [badge_npm]: https://img.shields.io/npm/v/@svrooij/sonos?style=for-the-badge [badge_sonos-cli]: https://img.shields.io/badge/sonos-cli-blue?style=for-the-badge @@ -106,12 +103,11 @@ specification. Contributions of any kind welcome! [badge_twitter]: https://img.shields.io/twitter/follow/svrooij?logo=twitter&style=for-the-badge [link_build]: https://github.com/svrooij/node-sonos-ts/actions -[link_discord]: https://discord.gg/VMtG6Ft36J [link_issues]: https://github.com/svrooij/node-sonos-ts/issues [link_npm]: https://www.npmjs.com/package/@svrooij/sonos [link_sonos-cli]: https://github.com/svrooij/sonos-cli -[link_sonos-docs]: https://svrooij.io/sonos-api-docs -[link_sonos-mqtt]: https://svrooij.io/sonos2mqtt -[link_sonos-typescript]: https://svrooij.io/node-sonos-ts +[link_sonos-docs]: https://sonos.svrooij.io/ +[link_sonos-mqtt]: https://sonos2mqtt.svrooij.io/ +[link_sonos-typescript]: https://sonos-ts.svrooij.io/ [link_sponsor]: https://github.com/sponsors/svrooij [link_twitter]: https://twitter.com/svrooij diff --git a/docs/sonos-device/services/alarm-clock-service.md b/docs/sonos-device/services/alarm-clock-service.md index 5525bf4..c23582c 100644 --- a/docs/sonos-device/services/alarm-clock-service.md +++ b/docs/sonos-device/services/alarm-clock-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Control the sonos alarms and times -The AlarmClock service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The AlarmClock service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/av-transport-service.md b/docs/sonos-device/services/av-transport-service.md index 6e5eb08..63fd9cf 100644 --- a/docs/sonos-device/services/av-transport-service.md +++ b/docs/sonos-device/services/av-transport-service.md @@ -7,9 +7,9 @@ grand_parent: Sonos device # AVTransport service {: .no_toc } -Service that controls stuff related to transport (play/pause/next/special urls) +Service that controls stuff related to transport (play/pause/next/special URLs) -The AVTransport service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The AVTransport service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/connection-manager-service.md b/docs/sonos-device/services/connection-manager-service.md index 9e15fc8..8d8c1eb 100644 --- a/docs/sonos-device/services/connection-manager-service.md +++ b/docs/sonos-device/services/connection-manager-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Services related to connections and protocols -The ConnectionManager service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The ConnectionManager service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/content-directory-service.md b/docs/sonos-device/services/content-directory-service.md index e63d8d4..efd0030 100644 --- a/docs/sonos-device/services/content-directory-service.md +++ b/docs/sonos-device/services/content-directory-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Browse for local content -The ContentDirectory service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The ContentDirectory service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice @@ -26,7 +26,7 @@ All actions that require input expect an object with the specified parameters, e ### Browse -Browse for content: Music library (A), share(S:), Sonos playlists(SQ:), Sonos favorites(FV:2), radio stations(R:0/0), radio shows(R:0/1). Recommendation: Send one request, check the `TotalMatches` and - if necessary - do additional requests with higher `StartingIndex`. In case of duplicates only the first is returned! Example: albums with same title, even if artists are different +Browse for content: Music library (A), share(S:), Sonos playlists(SQ:), Sonos favorites(FV:2), radio stations(R:0/0), radio shows(R:0/1), queue(Q:)). Recommendation: Send one request, check the `TotalMatches` and - if necessary - do additional requests with higher `StartingIndex`. In case of duplicates only the first is returned! Example: albums with same title, even if artists are different ```js const result = await sonos.ContentDirectoryService.Browse({ ObjectID:..., BrowseFlag:..., Filter:..., StartingIndex:..., RequestedCount:..., SortCriteria:... }); @@ -36,11 +36,11 @@ Input object: | property | type | description | |:----------|:-----|:------------| -| **ObjectID** | `string` | The search query, (`A:ARTIST` / `A:ALBUMARTIST` / `A:ALBUM` / `A:GENRE` / `A:COMPOSER` / `A:TRACKS` / `A:PLAYLISTS` / `S:` / `SQ:` / `FV:2` / `R:0/0` / `R:0/1`) with optionally `:search+query` behind it. | +| **ObjectID** | `string` | The search query, (`A:ARTIST` / `A:ALBUMARTIST` / `A:ALBUM` / `A:GENRE` / `A:COMPOSER` / `A:TRACKS` / `A:PLAYLISTS` / `FV:2` / `Q:`/ `R:0/0` / `R:0/1` / `S:` / `SQ:`) with optionally `:search+query` behind it. | | **BrowseFlag** | `string` | How to browse Allowed values: `BrowseMetadata` / `BrowseDirectChildren` | | **Filter** | `string` | Which fields should be returned `*` for all. | | **StartingIndex** | `number` | Paging, where to start, usually 0 | -| **RequestedCount** | `number` | Paging, number of items, maximum is 1,000. This parameter does NOT restrict the number of items being searched (filter) but only the number being returned. | +| **RequestedCount** | `number` | Paging, number of items, maximum is 1,000. This parameter does NOT restrict the number of items being searched (filter) but only the number being returned. Using 0 is equivalent to 1,000 | | **SortCriteria** | `string` | Sort the results based on metadata fields. `+upnp:artist,+dc:title` for sorting on artist then on title. | Output object: @@ -110,6 +110,8 @@ Output object: ### GetAlbumArtistDisplayOption +Get the current album art display option such as `WMP`, `ITUNES` or `NONE` + ```js const result = await sonos.ContentDirectoryService.GetAlbumArtistDisplayOption(); ``` @@ -214,6 +216,8 @@ Output object: ### RefreshShareIndex +Updates the music library (share) index + ```js const result = await sonos.ContentDirectoryService.RefreshShareIndex({ AlbumArtistDisplayOption:... }); ``` @@ -222,7 +226,7 @@ Input object: | property | type | description | |:----------|:-----|:------------| -| **AlbumArtistDisplayOption** | `string` | | +| **AlbumArtistDisplayOption** | `string` | `WMP`, `ITUNES` or `NONE` | This actions returns a boolean whether or not the requests succeeded. diff --git a/docs/sonos-device/services/device-properties-service.md b/docs/sonos-device/services/device-properties-service.md index d0442b3..3044545 100644 --- a/docs/sonos-device/services/device-properties-service.md +++ b/docs/sonos-device/services/device-properties-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Modify device properties, like LED status and stereo pairs -The DeviceProperties service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The DeviceProperties service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice @@ -40,6 +40,8 @@ This actions returns a boolean whether or not the requests succeeded. ### AddHTSatellite +Adds satellites and/or a sub woofer to a (main) player. The satellites become hidden. The main player RINCON_* is mandatory. RR: right - rear, LF: left - front, SW: subwoofer + ```js const result = await sonos.DevicePropertiesService.AddHTSatellite({ HTSatChanMapSet:... }); ``` @@ -48,10 +50,12 @@ Input object: | property | type | description | |:----------|:-----|:------------| -| **HTSatChanMapSet** | `string` | | +| **HTSatChanMapSet** | `string` | example: `RINCON_000PPP1400:LF,RF;RINCON_000RRR1400:RR;RINCON_000SSS1400:LR;RINCON_000QQQ1400:SW` | This actions returns a boolean whether or not the requests succeeded. +**Remarks** Not all speakers support satellites or sub woofer. Satellites should be of same type (e.g. Play:1) + ### CreateStereoPair Create a stereo pair (left, right speakers), right one becomes hidden @@ -68,7 +72,7 @@ Input object: This actions returns a boolean whether or not the requests succeeded. -**Remarks** No all speakers support StereoPairs +**Remarks** Not all speakers support StereoPairs ### EnterConfigMode @@ -294,6 +298,8 @@ This actions returns a boolean whether or not the requests succeeded. ### RemoveHTSatellite +Removes a satellite or a sub woofer from (main) player. The satellite becomes visible. + ```js const result = await sonos.DevicePropertiesService.RemoveHTSatellite({ SatRoomUUID:... }); ``` @@ -302,10 +308,12 @@ Input object: | property | type | description | |:----------|:-----|:------------| -| **SatRoomUUID** | `string` | | +| **SatRoomUUID** | `string` | example: `RINCON_000RRR1400` | This actions returns a boolean whether or not the requests succeeded. +**Remarks** Not all speakers support satellites or sub woofer. Multiples RINCON_* are not allowed. + ### RoomDetectionStartChirping ```js @@ -356,7 +364,7 @@ Input object: This actions returns a boolean whether or not the requests succeeded. -**Remarks** No all speakers support StereoPairs +**Remarks** Not all speakers support StereoPairs ### SetAutoplayLinkedZones diff --git a/docs/sonos-device/services/group-management-service.md b/docs/sonos-device/services/group-management-service.md index 62806ab..664297b 100644 --- a/docs/sonos-device/services/group-management-service.md +++ b/docs/sonos-device/services/group-management-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Services related to groups -The GroupManagement service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The GroupManagement service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/group-rendering-control-service.md b/docs/sonos-device/services/group-rendering-control-service.md index 21bb402..82e0198 100644 --- a/docs/sonos-device/services/group-rendering-control-service.md +++ b/docs/sonos-device/services/group-rendering-control-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Volume related controls for groups -The GroupRenderingControl service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The GroupRenderingControl service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/music-services-service.md b/docs/sonos-device/services/music-services-service.md index c32e20c..4e378f1 100644 --- a/docs/sonos-device/services/music-services-service.md +++ b/docs/sonos-device/services/music-services-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Access to external music services, like Spotify or Youtube Music -The MusicServices service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The MusicServices service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/q-play-service.md b/docs/sonos-device/services/q-play-service.md index d81c4a3..bee10c1 100644 --- a/docs/sonos-device/services/q-play-service.md +++ b/docs/sonos-device/services/q-play-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Services related to Chinese Tencent Qplay service -The QPlay service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The QPlay service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/queue-service.md b/docs/sonos-device/services/queue-service.md index c176787..a81f83c 100644 --- a/docs/sonos-device/services/queue-service.md +++ b/docs/sonos-device/services/queue-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Modify and browse queues -The Queue service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The Queue service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/rendering-control-service.md b/docs/sonos-device/services/rendering-control-service.md index 6952b18..e710da2 100644 --- a/docs/sonos-device/services/rendering-control-service.md +++ b/docs/sonos-device/services/rendering-control-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Volume related controls -The RenderingControl service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The RenderingControl service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/services.md b/docs/sonos-device/services/services.md index 821bcff..8706bcf 100644 --- a/docs/sonos-device/services/services.md +++ b/docs/sonos-device/services/services.md @@ -19,7 +19,7 @@ Every sonos speaker has several soap services. Each service has one or more acti |:--------|:------------| | [**AlarmClock service**](alarm-clock-service.html) | Control the sonos alarms and times | | [**AudioIn service**](audio-in-service.html) | Control line in | -| [**AVTransport service**](av-transport-service.html) | Service that controls stuff related to transport (play/pause/next/special urls) | +| [**AVTransport service**](av-transport-service.html) | Service that controls stuff related to transport (play/pause/next/special URLs) | | [**ConnectionManager service**](connection-manager-service.html) | Services related to connections and protocols | | [**ContentDirectory service**](content-directory-service.html) | Browse for local content | | [**DeviceProperties service**](device-properties-service.html) | Modify device properties, like LED status and stereo pairs | diff --git a/docs/sonos-device/services/system-properties-service.md b/docs/sonos-device/services/system-properties-service.md index 8fb01fd..b955f25 100644 --- a/docs/sonos-device/services/system-properties-service.md +++ b/docs/sonos-device/services/system-properties-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Manage system-wide settings, mainly account stuff -The SystemProperties service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The SystemProperties service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/virtual-line-in-service.md b/docs/sonos-device/services/virtual-line-in-service.md index de291b5..05cc45c 100644 --- a/docs/sonos-device/services/virtual-line-in-service.md +++ b/docs/sonos-device/services/virtual-line-in-service.md @@ -7,7 +7,7 @@ grand_parent: Sonos device # VirtualLineIn service {: .no_toc } -The VirtualLineIn service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The VirtualLineIn service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/docs/sonos-device/services/zone-group-topology-service.md b/docs/sonos-device/services/zone-group-topology-service.md index c4737ba..763c54b 100644 --- a/docs/sonos-device/services/zone-group-topology-service.md +++ b/docs/sonos-device/services/zone-group-topology-service.md @@ -9,7 +9,7 @@ grand_parent: Sonos device Zone config stuff, eg getting all the configured sonos zones -The ZoneGroupTopology service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S6` / `v2-S9` / `v2-Sub`. +The ZoneGroupTopology service is available on these models: `v2-S1` / `v2-S13` / `v2-S14` / `v2-S18` / `v2-S21` / `v2-S27` / `v2-S3` / `v2-S33` / `v2-S38` / `v2-S6` / `v2-S9` / `v2-Sub`. ```js const SonosDevice = require('@svrooij/sonos').SonosDevice diff --git a/examples/play-notification-audioclip.js b/examples/play-notification-audioclip.js index e55d61d..454d927 100644 --- a/examples/play-notification-audioclip.js +++ b/examples/play-notification-audioclip.js @@ -3,9 +3,9 @@ const SonosDevice = require('../lib').SonosDevice const sonos = new SonosDevice(process.env.SONOS_HOST || '192.168.96.56') // Pre-start listening for events for more efficient handling. -sonos.Events.on('currentTrack', (track) => { - console.log('TrackChanged %o', track); -}); +// sonos.Events.on('currentTrack', (track) => { +// console.log('TrackChanged %o', track); +// }); // setTimeout(async () => { @@ -25,17 +25,16 @@ sonos.Events.on('currentTrack', (track) => { sonos.PlayNotificationAudioClip({ trackUri: 'https://cdn.smartersoft-group.com/various/pull-bell-short.mp3', // Can be any uri sonos understands onlyWhenPlaying: false, // make sure that it only plays when you're listening to music. So it won't play when you're sleeping. - volume: 80, // Set the volume for the notification (and revert back afterwards) + volume: 30, // Set the volume for the notification (and revert back afterwards) }) .then(queued => { - console.log('Queued notification %o', queued) - + console.log('Played notification %o', queued) }) .catch((err) => { console.error(err); }) .finally(() => { - sonos.CancelEvents(); + //sonos.CancelEvents(); }); // If you have a TTS endpoint, you can do text-to-speech diff --git a/package.json b/package.json index 53e3281..923f2e8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "types": "lib/index.d.js", "scripts": { "build": "tsc", - "generate": "npx @svrooij/sonos-docs combine && npx @svrooij/sonos-docs generate ./.generator/ts/ ./", + "generate": "npm run generate:prepare && npm run generate:files", + "generate:prepare": "npx @svrooij/sonos-docs@1.3.0 combine", + "generate:files": "npx @svrooij/sonos-docs@1.3.0 generate ./.generator/ts/ ./", "lint": "eslint ./src/*.ts ./src/**/*.ts", "lint:fix": "eslint ./src/*.ts ./src/**/*.ts --fix", "prepack": "npm run build", @@ -25,12 +27,12 @@ "real-time", "home-automation" ], - "author": "Stephan van Rooij (https://svrooij.io)", + "author": "Stephan van Rooij (https://svrooij.io)", "license": "MIT", "bugs": { "url": "https://github.com/svrooij/node-sonos-ts/issues" }, - "homepage": "https://svrooij.io/node-sonos-ts/", + "homepage": "https://sonos-ts.svrooij.io/", "devDependencies": { "@types/chai": "^4.2.16", "@types/debug": "^4.1.5", diff --git a/src/services/alarm-clock.service.ts b/src/services/alarm-clock.service.ts index c118d34..a20b2d3 100644 --- a/src/services/alarm-clock.service.ts +++ b/src/services/alarm-clock.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -55,62 +55,62 @@ export class AlarmClockServiceBase extends BaseService { * @param {number} input.Volume - Volume between 0 and 100 * @param {boolean} input.IncludeLinkedZones - Should grouped players also play the alarm? */ - async CreateAlarm(input: { StartLocalTime: string; Duration: string; Recurrence: string; Enabled: boolean; RoomUUID: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): - Promise { return await this.SoapRequestWithBody('CreateAlarm', input); } + CreateAlarm(input: { StartLocalTime: string; Duration: string; Recurrence: string; Enabled: boolean; RoomUUID: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): + Promise { return this.SoapRequestWithBody('CreateAlarm', input); } /** * Delete an alarm * * @param {number} input.ID - The Alarm ID from ListAlarms */ - async DestroyAlarm(input: { ID: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('DestroyAlarm', input); } + DestroyAlarm(input: { ID: number }): + Promise { return this.SoapRequestWithBodyNoResponse('DestroyAlarm', input); } - async GetDailyIndexRefreshTime(): - Promise { return await this.SoapRequest('GetDailyIndexRefreshTime'); } + GetDailyIndexRefreshTime(): + Promise { return this.SoapRequest('GetDailyIndexRefreshTime'); } - async GetFormat(): - Promise { return await this.SoapRequest('GetFormat'); } + GetFormat(): + Promise { return this.SoapRequest('GetFormat'); } - async GetHouseholdTimeAtStamp(input: { TimeStamp: string }): - Promise { return await this.SoapRequestWithBody('GetHouseholdTimeAtStamp', input); } + GetHouseholdTimeAtStamp(input: { TimeStamp: string }): + Promise { return this.SoapRequestWithBody('GetHouseholdTimeAtStamp', input); } - async GetTimeNow(): - Promise { return await this.SoapRequest('GetTimeNow'); } + GetTimeNow(): + Promise { return this.SoapRequest('GetTimeNow'); } - async GetTimeServer(): - Promise { return await this.SoapRequest('GetTimeServer'); } + GetTimeServer(): + Promise { return this.SoapRequest('GetTimeServer'); } - async GetTimeZone(): - Promise { return await this.SoapRequest('GetTimeZone'); } + GetTimeZone(): + Promise { return this.SoapRequest('GetTimeZone'); } - async GetTimeZoneAndRule(): - Promise { return await this.SoapRequest('GetTimeZoneAndRule'); } + GetTimeZoneAndRule(): + Promise { return this.SoapRequest('GetTimeZoneAndRule'); } - async GetTimeZoneRule(input: { Index: number }): - Promise { return await this.SoapRequestWithBody('GetTimeZoneRule', input); } + GetTimeZoneRule(input: { Index: number }): + Promise { return this.SoapRequestWithBody('GetTimeZoneRule', input); } /** * Get the AlarmList as XML * @remarks Some libraries also provide a ListAndParseAlarms where the alarm list xml is parsed */ - async ListAlarms(): - Promise { return await this.SoapRequest('ListAlarms'); } + ListAlarms(): + Promise { return this.SoapRequest('ListAlarms'); } - async SetDailyIndexRefreshTime(input: { DesiredDailyIndexRefreshTime: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetDailyIndexRefreshTime', input); } + SetDailyIndexRefreshTime(input: { DesiredDailyIndexRefreshTime: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetDailyIndexRefreshTime', input); } - async SetFormat(input: { DesiredTimeFormat: string; DesiredDateFormat: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetFormat', input); } + SetFormat(input: { DesiredTimeFormat: string; DesiredDateFormat: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetFormat', input); } - async SetTimeNow(input: { DesiredTime: string; TimeZoneForDesiredTime: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetTimeNow', input); } + SetTimeNow(input: { DesiredTime: string; TimeZoneForDesiredTime: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetTimeNow', input); } - async SetTimeServer(input: { DesiredTimeServer: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetTimeServer', input); } + SetTimeServer(input: { DesiredTimeServer: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetTimeServer', input); } - async SetTimeZone(input: { Index: number; AutoAdjustDst: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetTimeZone', input); } + SetTimeZone(input: { Index: number; AutoAdjustDst: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetTimeZone', input); } /** * Update an alarm, all parameters are required. @@ -128,8 +128,8 @@ export class AlarmClockServiceBase extends BaseService { * @param {boolean} input.IncludeLinkedZones - Should grouped players also play the alarm? * @remarks Some libraries support PatchAlarm where you can update a single parameter */ - async UpdateAlarm(input: { ID: number; StartLocalTime: string; Duration: string; Recurrence: string; Enabled: boolean; RoomUUID: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('UpdateAlarm', input); } + UpdateAlarm(input: { ID: number; StartLocalTime: string; Duration: string; Recurrence: string; Enabled: boolean; RoomUUID: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('UpdateAlarm', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/audio-in.service.ts b/src/services/audio-in.service.ts index c05be15..2cd0886 100644 --- a/src/services/audio-in.service.ts +++ b/src/services/audio-in.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,26 +29,26 @@ export class AudioInService extends BaseService { readonly errors: SonosUpnpError[] = SonosUpnpErrors.defaultErrors; // #region actions - async GetAudioInputAttributes(): - Promise { return await this.SoapRequest('GetAudioInputAttributes'); } + GetAudioInputAttributes(): + Promise { return this.SoapRequest('GetAudioInputAttributes'); } - async GetLineInLevel(): - Promise { return await this.SoapRequest('GetLineInLevel'); } + GetLineInLevel(): + Promise { return this.SoapRequest('GetLineInLevel'); } - async SelectAudio(input: { ObjectID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SelectAudio', input); } + SelectAudio(input: { ObjectID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SelectAudio', input); } - async SetAudioInputAttributes(input: { DesiredName: string; DesiredIcon: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAudioInputAttributes', input); } + SetAudioInputAttributes(input: { DesiredName: string; DesiredIcon: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAudioInputAttributes', input); } - async SetLineInLevel(input: { DesiredLeftLineInLevel: number; DesiredRightLineInLevel: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetLineInLevel', input); } + SetLineInLevel(input: { DesiredLeftLineInLevel: number; DesiredRightLineInLevel: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetLineInLevel', input); } - async StartTransmissionToGroup(input: { CoordinatorID: string }): - Promise { return await this.SoapRequestWithBody('StartTransmissionToGroup', input); } + StartTransmissionToGroup(input: { CoordinatorID: string }): + Promise { return this.SoapRequestWithBody('StartTransmissionToGroup', input); } - async StopTransmissionToGroup(input: { CoordinatorID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('StopTransmissionToGroup', input); } + StopTransmissionToGroup(input: { CoordinatorID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('StopTransmissionToGroup', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/av-transport.service.ts b/src/services/av-transport.service.ts index 3a00f44..e255f47 100644 --- a/src/services/av-transport.service.ts +++ b/src/services/av-transport.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -14,7 +14,7 @@ import { } from '../models'; /** - * Service that controls stuff related to transport (play/pause/next/special urls) + * Service that controls stuff related to transport (play/pause/next/special URLs) * * @export * @class AVTransportService @@ -62,8 +62,8 @@ export class AVTransportService extends BaseService { ]; // #region actions - async AddMultipleURIsToQueue(input: { InstanceID: number; UpdateID: number; NumberOfURIs: number; EnqueuedURIs: string; EnqueuedURIsMetaData: Track | string; ContainerURI: string; ContainerMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): - Promise { return await this.SoapRequestWithBody('AddMultipleURIsToQueue', input); } + AddMultipleURIsToQueue(input: { InstanceID: number; UpdateID: number; NumberOfURIs: number; EnqueuedURIs: string; EnqueuedURIsMetaData: Track | string; ContainerURI: string; ContainerMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): + Promise { return this.SoapRequestWithBody('AddMultipleURIsToQueue', input); } /** * Adds songs to the SONOS queue @@ -75,34 +75,34 @@ export class AVTransportService extends BaseService { * @param {boolean} input.EnqueueAsNext * @remarks In NORMAL play mode the songs are added prior to the specified `DesiredFirstTrackNumberEnqueued`. */ - async AddURIToQueue(input: { InstanceID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): - Promise { return await this.SoapRequestWithBody('AddURIToQueue', input); } + AddURIToQueue(input: { InstanceID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): + Promise { return this.SoapRequestWithBody('AddURIToQueue', input); } - async AddURIToSavedQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; AddAtIndex: number }): - Promise { return await this.SoapRequestWithBody('AddURIToSavedQueue', input); } + AddURIToSavedQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; AddAtIndex: number }): + Promise { return this.SoapRequestWithBody('AddURIToSavedQueue', input); } - async BackupQueue(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('BackupQueue', input); } + BackupQueue(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('BackupQueue', input); } /** * Leave the current group and revert to a single player. * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async BecomeCoordinatorOfStandaloneGroup(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('BecomeCoordinatorOfStandaloneGroup', input); } + BecomeCoordinatorOfStandaloneGroup(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('BecomeCoordinatorOfStandaloneGroup', input); } - async BecomeGroupCoordinator(input: { InstanceID: number; CurrentCoordinator: string; CurrentGroupID: string; OtherMembers: string; TransportSettings: string; CurrentURI: string; CurrentURIMetaData: Track | string; SleepTimerState: string; AlarmState: string; StreamRestartState: string; CurrentQueueTrackList: string; CurrentVLIState: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('BecomeGroupCoordinator', input); } + BecomeGroupCoordinator(input: { InstanceID: number; CurrentCoordinator: string; CurrentGroupID: string; OtherMembers: string; TransportSettings: string; CurrentURI: string; CurrentURIMetaData: Track | string; SleepTimerState: string; AlarmState: string; StreamRestartState: string; CurrentQueueTrackList: string; CurrentVLIState: string }): + Promise { return this.SoapRequestWithBodyNoResponse('BecomeGroupCoordinator', input); } - async BecomeGroupCoordinatorAndSource(input: { InstanceID: number; CurrentCoordinator: string; CurrentGroupID: string; OtherMembers: string; CurrentURI: string; CurrentURIMetaData: Track | string; SleepTimerState: string; AlarmState: string; StreamRestartState: string; CurrentAVTTrackList: string; CurrentQueueTrackList: string; CurrentSourceState: string; ResumePlayback: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('BecomeGroupCoordinatorAndSource', input); } + BecomeGroupCoordinatorAndSource(input: { InstanceID: number; CurrentCoordinator: string; CurrentGroupID: string; OtherMembers: string; CurrentURI: string; CurrentURIMetaData: Track | string; SleepTimerState: string; AlarmState: string; StreamRestartState: string; CurrentAVTTrackList: string; CurrentQueueTrackList: string; CurrentSourceState: string; ResumePlayback: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('BecomeGroupCoordinatorAndSource', input); } - async ChangeCoordinator(input: { InstanceID: number; CurrentCoordinator: string; NewCoordinator: string; NewTransportSettings: string; CurrentAVTransportURI: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ChangeCoordinator', input); } + ChangeCoordinator(input: { InstanceID: number; CurrentCoordinator: string; NewCoordinator: string; NewTransportSettings: string; CurrentAVTransportURI: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ChangeCoordinator', input); } - async ChangeTransportSettings(input: { InstanceID: number; NewTransportSettings: string; CurrentAVTransportURI: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ChangeTransportSettings', input); } + ChangeTransportSettings(input: { InstanceID: number; NewTransportSettings: string; CurrentAVTransportURI: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ChangeTransportSettings', input); } /** * Stop playing after set sleep timer or cancel @@ -111,11 +111,11 @@ export class AVTransportService extends BaseService { * @param {string} input.NewSleepTimerDuration - Time to stop after, as `hh:mm:ss` or empty string to cancel * @remarks Send to non-coordinator returns error code 800 */ - async ConfigureSleepTimer(input: { InstanceID: number; NewSleepTimerDuration: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ConfigureSleepTimer', input); } + ConfigureSleepTimer(input: { InstanceID: number; NewSleepTimerDuration: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ConfigureSleepTimer', input); } - async CreateSavedQueue(input: { InstanceID: number; Title: string; EnqueuedURI: string; EnqueuedURIMetaData: Track | string }): - Promise { return await this.SoapRequestWithBody('CreateSavedQueue', input); } + CreateSavedQueue(input: { InstanceID: number; Title: string; EnqueuedURI: string; EnqueuedURIMetaData: Track | string }): + Promise { return this.SoapRequestWithBody('CreateSavedQueue', input); } /** * Delegates the coordinator role to another player in the same group @@ -125,11 +125,11 @@ export class AVTransportService extends BaseService { * @param {boolean} input.RejoinGroup - Should former coordinator rejoin the group? * @remarks Send to non-coordinator has no results - should be avoided. */ - async DelegateGroupCoordinationTo(input: { InstanceID: number; NewCoordinator: string; RejoinGroup: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('DelegateGroupCoordinationTo', input); } + DelegateGroupCoordinationTo(input: { InstanceID: number; NewCoordinator: string; RejoinGroup: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('DelegateGroupCoordinationTo', input); } - async EndDirectControlSession(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('EndDirectControlSession', input); } + EndDirectControlSession(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('EndDirectControlSession', input); } /** * Get crossfade mode @@ -137,8 +137,8 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Send to non-coordinator may return wrong value as only the coordinator value in a group */ - async GetCrossfadeMode(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetCrossfadeMode', input); } + GetCrossfadeMode(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetCrossfadeMode', input); } /** * Get current transport actions such as Set, Stop, Pause, Play, X_DLNA_SeekTime, Next, X_DLNA_SeekTrackNr @@ -146,27 +146,27 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Send to non-coordinator returns only `Start` and `Stop` since it cannot control the stream. */ - async GetCurrentTransportActions(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetCurrentTransportActions', input); } + GetCurrentTransportActions(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetCurrentTransportActions', input); } - async GetDeviceCapabilities(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetDeviceCapabilities', input); } + GetDeviceCapabilities(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetDeviceCapabilities', input); } /** * Get information about the current playing media (queue) * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async GetMediaInfo(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetMediaInfo', input); } + GetMediaInfo(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetMediaInfo', input); } /** * Get information about current position (position in queue and time in current song) * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async GetPositionInfo(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetPositionInfo', input); } + GetPositionInfo(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetPositionInfo', input); } /** * Get time left on sleeptimer. @@ -174,11 +174,11 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Send to non-coordinator returns error code 800 */ - async GetRemainingSleepTimerDuration(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetRemainingSleepTimerDuration', input); } + GetRemainingSleepTimerDuration(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetRemainingSleepTimerDuration', input); } - async GetRunningAlarmProperties(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetRunningAlarmProperties', input); } + GetRunningAlarmProperties(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetRunningAlarmProperties', input); } /** * Get current transport status, speed and state such as PLAYING, STOPPED, PLAYING, PAUSED_PLAYBACK, TRANSITIONING, NO_MEDIA_PRESENT @@ -186,8 +186,8 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Send to non-coordinator always returns PLAYING */ - async GetTransportInfo(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetTransportInfo', input); } + GetTransportInfo(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetTransportInfo', input); } /** * Get transport settings @@ -195,8 +195,8 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Send to non-coordinator returns the settings of it's queue */ - async GetTransportSettings(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetTransportSettings', input); } + GetTransportSettings(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetTransportSettings', input); } /** * Go to next song @@ -204,19 +204,19 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Possibly not supported at the moment see GetCurrentTransportActions */ - async Next(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Next', input); } + Next(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Next', input); } - async NotifyDeletedURI(input: { InstanceID: number; DeletedURI: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('NotifyDeletedURI', input); } + NotifyDeletedURI(input: { InstanceID: number; DeletedURI: string }): + Promise { return this.SoapRequestWithBodyNoResponse('NotifyDeletedURI', input); } /** * Pause playback * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async Pause(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Pause', input); } + Pause(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Pause', input); } /** * Start playing the set TransportURI @@ -224,8 +224,8 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @param {string} input.Speed - Play speed usually 1, can be a fraction of 1 [ '1' ] */ - async Play(input: { InstanceID: number; Speed: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('Play', input); } + Play(input: { InstanceID: number; Speed: string }): + Promise { return this.SoapRequestWithBodyNoResponse('Play', input); } /** * Go to previous song @@ -233,8 +233,8 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks Possibly not supported at the moment see GetCurrentTransportActions */ - async Previous(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Previous', input); } + Previous(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Previous', input); } /** * Flushes the SONOS queue. @@ -242,11 +242,11 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @remarks If queue is already empty it throw error 804. Send to non-coordinator returns error code 800. */ - async RemoveAllTracksFromQueue(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveAllTracksFromQueue', input); } + RemoveAllTracksFromQueue(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveAllTracksFromQueue', input); } - async RemoveTrackFromQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveTrackFromQueue', input); } + RemoveTrackFromQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveTrackFromQueue', input); } /** * Removes the specified range of songs from the SONOS queue. @@ -256,17 +256,17 @@ export class AVTransportService extends BaseService { * @param {number} input.StartingIndex - between 1 and queue-length * @param {number} input.NumberOfTracks */ - async RemoveTrackRangeFromQueue(input: { InstanceID: number; UpdateID: number; StartingIndex: number; NumberOfTracks: number }): - Promise { return await this.SoapRequestWithBody('RemoveTrackRangeFromQueue', input); } + RemoveTrackRangeFromQueue(input: { InstanceID: number; UpdateID: number; StartingIndex: number; NumberOfTracks: number }): + Promise { return this.SoapRequestWithBody('RemoveTrackRangeFromQueue', input); } - async ReorderTracksInQueue(input: { InstanceID: number; StartingIndex: number; NumberOfTracks: number; InsertBefore: number; UpdateID: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('ReorderTracksInQueue', input); } + ReorderTracksInQueue(input: { InstanceID: number; StartingIndex: number; NumberOfTracks: number; InsertBefore: number; UpdateID: number }): + Promise { return this.SoapRequestWithBodyNoResponse('ReorderTracksInQueue', input); } - async ReorderTracksInSavedQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number; TrackList: string; NewPositionList: string }): - Promise { return await this.SoapRequestWithBody('ReorderTracksInSavedQueue', input); } + ReorderTracksInSavedQueue(input: { InstanceID: number; ObjectID: string; UpdateID: number; TrackList: string; NewPositionList: string }): + Promise { return this.SoapRequestWithBody('ReorderTracksInSavedQueue', input); } - async RunAlarm(input: { InstanceID: number; AlarmID: number; LoggedStartTime: string; Duration: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('RunAlarm', input); } + RunAlarm(input: { InstanceID: number; AlarmID: number; LoggedStartTime: string; Duration: string; ProgramURI: string; ProgramMetaData: Track | string; PlayMode: PlayMode; Volume: number; IncludeLinkedZones: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('RunAlarm', input); } /** * Saves the current SONOS queue as a SONOS playlist and outputs objectID @@ -276,8 +276,8 @@ export class AVTransportService extends BaseService { * @param {string} input.ObjectID - Leave blank * @remarks Send to non-coordinator returns error code 800 */ - async SaveQueue(input: { InstanceID: number; Title: string; ObjectID: string }): - Promise { return await this.SoapRequestWithBody('SaveQueue', input); } + SaveQueue(input: { InstanceID: number; Title: string; ObjectID: string }): + Promise { return this.SoapRequestWithBody('SaveQueue', input); } /** * Seek track in queue, time delta or absolute time in song @@ -287,8 +287,8 @@ export class AVTransportService extends BaseService { * @param {string} input.Target - Position of track in queue (start at 1) or `hh:mm:ss` for `REL_TIME` or `+/-hh:mm:ss` for `TIME_DELTA` * @remarks Returns error code 701 in case that content does not support Seek or send to non-coordinator */ - async Seek(input: { InstanceID: number; Unit: string; Target: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('Seek', input); } + Seek(input: { InstanceID: number; Unit: string; Target: string }): + Promise { return this.SoapRequestWithBodyNoResponse('Seek', input); } /** * Set the transport URI to a song, a stream, the queue, another player-rincon and a lot more @@ -298,8 +298,8 @@ export class AVTransportService extends BaseService { * @param {Track | string} input.CurrentURIMetaData - Track Metadata, see MetadataHelper.GuessTrack to guess based on track uri * @remarks If set to another player RINCON, the player is grouped with that one. */ - async SetAVTransportURI(input: { InstanceID: number; CurrentURI: string; CurrentURIMetaData: Track | string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAVTransportURI', input); } + SetAVTransportURI(input: { InstanceID: number; CurrentURI: string; CurrentURIMetaData: Track | string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAVTransportURI', input); } /** * Set crossfade mode @@ -308,11 +308,11 @@ export class AVTransportService extends BaseService { * @param {boolean} input.CrossfadeMode * @remarks Send to non-coordinator returns error code 800. Same for content, which does not support crossfade mode. */ - async SetCrossfadeMode(input: { InstanceID: number; CrossfadeMode: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetCrossfadeMode', input); } + SetCrossfadeMode(input: { InstanceID: number; CrossfadeMode: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetCrossfadeMode', input); } - async SetNextAVTransportURI(input: { InstanceID: number; NextURI: string; NextURIMetaData: Track | string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetNextAVTransportURI', input); } + SetNextAVTransportURI(input: { InstanceID: number; NextURI: string; NextURIMetaData: Track | string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetNextAVTransportURI', input); } /** * Set the PlayMode @@ -321,8 +321,8 @@ export class AVTransportService extends BaseService { * @param {PlayMode} input.NewPlayMode - New playmode [ 'NORMAL' / 'REPEAT_ALL' / 'REPEAT_ONE' / 'SHUFFLE_NOREPEAT' / 'SHUFFLE' / 'SHUFFLE_REPEAT_ONE' ] * @remarks Send to non-coordinator returns error code 712. If SONOS queue is not activated returns error code 712. */ - async SetPlayMode(input: { InstanceID: number; NewPlayMode: PlayMode }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetPlayMode', input); } + SetPlayMode(input: { InstanceID: number; NewPlayMode: PlayMode }): + Promise { return this.SoapRequestWithBodyNoResponse('SetPlayMode', input); } /** * Snooze the current alarm for some time. @@ -330,19 +330,19 @@ export class AVTransportService extends BaseService { * @param {number} input.InstanceID - InstanceID should always be `0` * @param {string} input.Duration - Snooze time as `hh:mm:ss`, 10 minutes = 00:10:00 */ - async SnoozeAlarm(input: { InstanceID: number; Duration: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SnoozeAlarm', input); } + SnoozeAlarm(input: { InstanceID: number; Duration: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SnoozeAlarm', input); } - async StartAutoplay(input: { InstanceID: number; ProgramURI: string; ProgramMetaData: Track | string; Volume: number; IncludeLinkedZones: boolean; ResetVolumeAfter: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('StartAutoplay', input); } + StartAutoplay(input: { InstanceID: number; ProgramURI: string; ProgramMetaData: Track | string; Volume: number; IncludeLinkedZones: boolean; ResetVolumeAfter: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('StartAutoplay', input); } /** * Stop playback * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async Stop(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Stop', input); } + Stop(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Stop', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/connection-manager.service.ts b/src/services/connection-manager.service.ts index c894869..458bc60 100644 --- a/src/services/connection-manager.service.ts +++ b/src/services/connection-manager.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,14 +29,14 @@ export class ConnectionManagerService extends BaseService { return await this.SoapRequest('GetCurrentConnectionIDs'); } + GetCurrentConnectionIDs(): + Promise { return this.SoapRequest('GetCurrentConnectionIDs'); } - async GetCurrentConnectionInfo(input: { ConnectionID: number }): - Promise { return await this.SoapRequestWithBody('GetCurrentConnectionInfo', input); } + GetCurrentConnectionInfo(input: { ConnectionID: number }): + Promise { return this.SoapRequestWithBody('GetCurrentConnectionInfo', input); } - async GetProtocolInfo(): - Promise { return await this.SoapRequest('GetProtocolInfo'); } + GetProtocolInfo(): + Promise { return this.SoapRequest('GetProtocolInfo'); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/content-directory.service.ts b/src/services/content-directory.service.ts index ea97d73..4f35c65 100644 --- a/src/services/content-directory.service.ts +++ b/src/services/content-directory.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -60,63 +60,71 @@ export class ContentDirectoryServiceBase extends BaseService { return await this.SoapRequestWithBody('Browse', input); } + Browse(input: { ObjectID: string; BrowseFlag: string; Filter: string; StartingIndex: number; RequestedCount: number; SortCriteria: string }): + Promise { return this.SoapRequestWithBody('Browse', input); } - async CreateObject(input: { ContainerID: string; Elements: string }): - Promise { return await this.SoapRequestWithBody('CreateObject', input); } + CreateObject(input: { ContainerID: string; Elements: string }): + Promise { return this.SoapRequestWithBody('CreateObject', input); } - async DestroyObject(input: { ObjectID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('DestroyObject', input); } + DestroyObject(input: { ObjectID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('DestroyObject', input); } - async FindPrefix(input: { ObjectID: string; Prefix: string }): - Promise { return await this.SoapRequestWithBody('FindPrefix', input); } + FindPrefix(input: { ObjectID: string; Prefix: string }): + Promise { return this.SoapRequestWithBody('FindPrefix', input); } - async GetAlbumArtistDisplayOption(): - Promise { return await this.SoapRequest('GetAlbumArtistDisplayOption'); } + /** + * Get the current album art display option such as `WMP`, `ITUNES` or `NONE` + */ + GetAlbumArtistDisplayOption(): + Promise { return this.SoapRequest('GetAlbumArtistDisplayOption'); } - async GetAllPrefixLocations(input: { ObjectID: string }): - Promise { return await this.SoapRequestWithBody('GetAllPrefixLocations', input); } + GetAllPrefixLocations(input: { ObjectID: string }): + Promise { return this.SoapRequestWithBody('GetAllPrefixLocations', input); } - async GetBrowseable(): - Promise { return await this.SoapRequest('GetBrowseable'); } + GetBrowseable(): + Promise { return this.SoapRequest('GetBrowseable'); } - async GetLastIndexChange(): - Promise { return await this.SoapRequest('GetLastIndexChange'); } + GetLastIndexChange(): + Promise { return this.SoapRequest('GetLastIndexChange'); } - async GetSearchCapabilities(): - Promise { return await this.SoapRequest('GetSearchCapabilities'); } + GetSearchCapabilities(): + Promise { return this.SoapRequest('GetSearchCapabilities'); } - async GetShareIndexInProgress(): - Promise { return await this.SoapRequest('GetShareIndexInProgress'); } + GetShareIndexInProgress(): + Promise { return this.SoapRequest('GetShareIndexInProgress'); } - async GetSortCapabilities(): - Promise { return await this.SoapRequest('GetSortCapabilities'); } + GetSortCapabilities(): + Promise { return this.SoapRequest('GetSortCapabilities'); } - async GetSystemUpdateID(): - Promise { return await this.SoapRequest('GetSystemUpdateID'); } + GetSystemUpdateID(): + Promise { return this.SoapRequest('GetSystemUpdateID'); } - async RefreshShareIndex(input: { AlbumArtistDisplayOption: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RefreshShareIndex', input); } + /** + * Updates the music library (share) index + * + * @param {string} input.AlbumArtistDisplayOption - `WMP`, `ITUNES` or `NONE` + */ + RefreshShareIndex(input: { AlbumArtistDisplayOption: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RefreshShareIndex', input); } - async RequestResort(input: { SortOrder: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RequestResort', input); } + RequestResort(input: { SortOrder: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RequestResort', input); } - async SetBrowseable(input: { Browseable: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetBrowseable', input); } + SetBrowseable(input: { Browseable: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetBrowseable', input); } - async UpdateObject(input: { ObjectID: string; CurrentTagValue: string; NewTagValue: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('UpdateObject', input); } + UpdateObject(input: { ObjectID: string; CurrentTagValue: string; NewTagValue: string }): + Promise { return this.SoapRequestWithBodyNoResponse('UpdateObject', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/device-properties.service.ts b/src/services/device-properties.service.ts index d01efc7..34e5b0f 100644 --- a/src/services/device-properties.service.ts +++ b/src/services/device-properties.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,120 +29,132 @@ export class DevicePropertiesService extends BaseService { return await this.SoapRequestWithBodyNoResponse('AddBondedZones', input); } + AddBondedZones(input: { ChannelMapSet: string }): + Promise { return this.SoapRequestWithBodyNoResponse('AddBondedZones', input); } - async AddHTSatellite(input: { HTSatChanMapSet: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('AddHTSatellite', input); } + /** + * Adds satellites and/or a sub woofer to a (main) player. The satellites become hidden. The main player RINCON_* is mandatory. RR: right - rear, LF: left - front, SW: subwoofer + * + * @param {string} input.HTSatChanMapSet - example: `RINCON_000PPP1400:LF,RF;RINCON_000RRR1400:RR;RINCON_000SSS1400:LR;RINCON_000QQQ1400:SW` + * @remarks Not all speakers support satellites or sub woofer. Satellites should be of same type (e.g. Play:1) + */ + AddHTSatellite(input: { HTSatChanMapSet: string }): + Promise { return this.SoapRequestWithBodyNoResponse('AddHTSatellite', input); } /** * Create a stereo pair (left, right speakers), right one becomes hidden * * @param {string} input.ChannelMapSet - example: `RINCON_B8E9375831C001400:LF,LF;RINCON_000E58FE3AEA01400:RF,RF` - * @remarks No all speakers support StereoPairs + * @remarks Not all speakers support StereoPairs */ - async CreateStereoPair(input: { ChannelMapSet: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('CreateStereoPair', input); } + CreateStereoPair(input: { ChannelMapSet: string }): + Promise { return this.SoapRequestWithBodyNoResponse('CreateStereoPair', input); } - async EnterConfigMode(input: { Mode: string; Options: string }): - Promise { return await this.SoapRequestWithBody('EnterConfigMode', input); } + EnterConfigMode(input: { Mode: string; Options: string }): + Promise { return this.SoapRequestWithBody('EnterConfigMode', input); } - async ExitConfigMode(input: { Options: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ExitConfigMode', input); } + ExitConfigMode(input: { Options: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ExitConfigMode', input); } - async GetAutoplayLinkedZones(input: { Source: string }): - Promise { return await this.SoapRequestWithBody('GetAutoplayLinkedZones', input); } + GetAutoplayLinkedZones(input: { Source: string }): + Promise { return this.SoapRequestWithBody('GetAutoplayLinkedZones', input); } - async GetAutoplayRoomUUID(input: { Source: string }): - Promise { return await this.SoapRequestWithBody('GetAutoplayRoomUUID', input); } + GetAutoplayRoomUUID(input: { Source: string }): + Promise { return this.SoapRequestWithBody('GetAutoplayRoomUUID', input); } - async GetAutoplayVolume(input: { Source: string }): - Promise { return await this.SoapRequestWithBody('GetAutoplayVolume', input); } + GetAutoplayVolume(input: { Source: string }): + Promise { return this.SoapRequestWithBody('GetAutoplayVolume', input); } /** * Get the current button lock state */ - async GetButtonLockState(): - Promise { return await this.SoapRequest('GetButtonLockState'); } + GetButtonLockState(): + Promise { return this.SoapRequest('GetButtonLockState'); } - async GetButtonState(): - Promise { return await this.SoapRequest('GetButtonState'); } + GetButtonState(): + Promise { return this.SoapRequest('GetButtonState'); } - async GetHouseholdID(): - Promise { return await this.SoapRequest('GetHouseholdID'); } + GetHouseholdID(): + Promise { return this.SoapRequest('GetHouseholdID'); } - async GetHTForwardState(): - Promise { return await this.SoapRequest('GetHTForwardState'); } + GetHTForwardState(): + Promise { return this.SoapRequest('GetHTForwardState'); } /** * Get the current LED state */ - async GetLEDState(): - Promise { return await this.SoapRequest('GetLEDState'); } + GetLEDState(): + Promise { return this.SoapRequest('GetLEDState'); } - async GetUseAutoplayVolume(input: { Source: string }): - Promise { return await this.SoapRequestWithBody('GetUseAutoplayVolume', input); } + GetUseAutoplayVolume(input: { Source: string }): + Promise { return this.SoapRequestWithBody('GetUseAutoplayVolume', input); } - async GetZoneAttributes(): - Promise { return await this.SoapRequest('GetZoneAttributes'); } + GetZoneAttributes(): + Promise { return this.SoapRequest('GetZoneAttributes'); } /** * Get information about this specific speaker */ - async GetZoneInfo(): - Promise { return await this.SoapRequest('GetZoneInfo'); } + GetZoneInfo(): + Promise { return this.SoapRequest('GetZoneInfo'); } - async RemoveBondedZones(input: { ChannelMapSet: string; KeepGrouped: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveBondedZones', input); } + RemoveBondedZones(input: { ChannelMapSet: string; KeepGrouped: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveBondedZones', input); } - async RemoveHTSatellite(input: { SatRoomUUID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveHTSatellite', input); } + /** + * Removes a satellite or a sub woofer from (main) player. The satellite becomes visible. + * + * @param {string} input.SatRoomUUID - example: `RINCON_000RRR1400` + * @remarks Not all speakers support satellites or sub woofer. Multiples RINCON_* are not allowed. + */ + RemoveHTSatellite(input: { SatRoomUUID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveHTSatellite', input); } - async RoomDetectionStartChirping(input: { Channel: number; DurationMilliseconds: number; ChirpIfPlayingSwappableAudio: boolean }): - Promise { return await this.SoapRequestWithBody('RoomDetectionStartChirping', input); } + RoomDetectionStartChirping(input: { Channel: number; DurationMilliseconds: number; ChirpIfPlayingSwappableAudio: boolean }): + Promise { return this.SoapRequestWithBody('RoomDetectionStartChirping', input); } - async RoomDetectionStopChirping(input: { PlayId: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('RoomDetectionStopChirping', input); } + RoomDetectionStopChirping(input: { PlayId: number }): + Promise { return this.SoapRequestWithBodyNoResponse('RoomDetectionStopChirping', input); } /** * Separate a stereo pair * * @param {string} input.ChannelMapSet - example: `RINCON_B8E9375831C001400:LF,LF;RINCON_000E58FE3AEA01400:RF,RF` - * @remarks No all speakers support StereoPairs + * @remarks Not all speakers support StereoPairs */ - async SeparateStereoPair(input: { ChannelMapSet: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SeparateStereoPair', input); } + SeparateStereoPair(input: { ChannelMapSet: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SeparateStereoPair', input); } - async SetAutoplayLinkedZones(input: { IncludeLinkedZones: boolean; Source: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAutoplayLinkedZones', input); } + SetAutoplayLinkedZones(input: { IncludeLinkedZones: boolean; Source: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAutoplayLinkedZones', input); } - async SetAutoplayRoomUUID(input: { RoomUUID: string; Source: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAutoplayRoomUUID', input); } + SetAutoplayRoomUUID(input: { RoomUUID: string; Source: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAutoplayRoomUUID', input); } - async SetAutoplayVolume(input: { Volume: number; Source: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAutoplayVolume', input); } + SetAutoplayVolume(input: { Volume: number; Source: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAutoplayVolume', input); } /** * Set the button lock state * * @param {string} input.DesiredButtonLockState [ 'On' / 'Off' ] */ - async SetButtonLockState(input: { DesiredButtonLockState: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetButtonLockState', input); } + SetButtonLockState(input: { DesiredButtonLockState: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetButtonLockState', input); } /** * Set the LED state * * @param {string} input.DesiredLEDState [ 'On' / 'Off' ] */ - async SetLEDState(input: { DesiredLEDState: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetLEDState', input); } + SetLEDState(input: { DesiredLEDState: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetLEDState', input); } - async SetUseAutoplayVolume(input: { UseVolume: boolean; Source: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetUseAutoplayVolume', input); } + SetUseAutoplayVolume(input: { UseVolume: boolean; Source: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetUseAutoplayVolume', input); } - async SetZoneAttributes(input: { DesiredZoneName: string; DesiredIcon: string; DesiredConfiguration: string; DesiredTargetRoomName: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetZoneAttributes', input); } + SetZoneAttributes(input: { DesiredZoneName: string; DesiredIcon: string; DesiredConfiguration: string; DesiredTargetRoomName: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetZoneAttributes', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/group-management.service.ts b/src/services/group-management.service.ts index bfb3701..00c72bb 100644 --- a/src/services/group-management.service.ts +++ b/src/services/group-management.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,17 +29,17 @@ export class GroupManagementService extends BaseService { return await this.SoapRequestWithBody('AddMember', input); } + AddMember(input: { MemberID: string; BootSeq: number }): + Promise { return this.SoapRequestWithBody('AddMember', input); } - async RemoveMember(input: { MemberID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveMember', input); } + RemoveMember(input: { MemberID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveMember', input); } - async ReportTrackBufferingResult(input: { MemberID: string; ResultCode: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('ReportTrackBufferingResult', input); } + ReportTrackBufferingResult(input: { MemberID: string; ResultCode: number }): + Promise { return this.SoapRequestWithBodyNoResponse('ReportTrackBufferingResult', input); } - async SetSourceAreaIds(input: { DesiredSourceAreaIds: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetSourceAreaIds', input); } + SetSourceAreaIds(input: { DesiredSourceAreaIds: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetSourceAreaIds', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/group-rendering-control.service.ts b/src/services/group-rendering-control.service.ts index e37524e..53d295e 100644 --- a/src/services/group-rendering-control.service.ts +++ b/src/services/group-rendering-control.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -44,8 +44,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBody('GetGroupMute', input); } + GetGroupMute(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetGroupMute', input); } /** * Get the group volume. @@ -53,8 +53,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBody('GetGroupVolume', input); } + GetGroupVolume(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetGroupVolume', input); } /** * (Un-/)Mute the entire group @@ -63,8 +63,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetGroupMute', input); } + SetGroupMute(input: { InstanceID: number; DesiredMute: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetGroupMute', input); } /** * Change group volume. Players volume will be changed proportionally based on last snapshot @@ -73,8 +73,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetGroupVolume', input); } + SetGroupVolume(input: { InstanceID: number; DesiredVolume: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetGroupVolume', input); } /** * Relatively change group volume - returns final group volume. Players volume will be changed proportionally based on last snapshot @@ -83,8 +83,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBody('SetRelativeGroupVolume', input); } + SetRelativeGroupVolume(input: { InstanceID: number; Adjustment: number }): + Promise { return this.SoapRequestWithBody('SetRelativeGroupVolume', input); } /** * Creates a new group volume snapshot, the volume ratio between all players. It is used by SetGroupVolume and SetRelativeGroupVolume @@ -92,8 +92,8 @@ export class GroupRenderingControlService extends BaseService { return await this.SoapRequestWithBodyNoResponse('SnapshotGroupVolume', input); } + SnapshotGroupVolume(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('SnapshotGroupVolume', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/ht-control.service.ts b/src/services/ht-control.service.ts index 067a248..d162f27 100644 --- a/src/services/ht-control.service.ts +++ b/src/services/ht-control.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,29 +29,29 @@ export class HTControlService extends BaseService { readonly errors: SonosUpnpError[] = SonosUpnpErrors.defaultErrors; // #region actions - async CommitLearnedIRCodes(input: { Name: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('CommitLearnedIRCodes', input); } + CommitLearnedIRCodes(input: { Name: string }): + Promise { return this.SoapRequestWithBodyNoResponse('CommitLearnedIRCodes', input); } - async GetIRRepeaterState(): - Promise { return await this.SoapRequest('GetIRRepeaterState'); } + GetIRRepeaterState(): + Promise { return this.SoapRequest('GetIRRepeaterState'); } - async GetLEDFeedbackState(): - Promise { return await this.SoapRequest('GetLEDFeedbackState'); } + GetLEDFeedbackState(): + Promise { return this.SoapRequest('GetLEDFeedbackState'); } - async IdentifyIRRemote(input: { Timeout: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('IdentifyIRRemote', input); } + IdentifyIRRemote(input: { Timeout: number }): + Promise { return this.SoapRequestWithBodyNoResponse('IdentifyIRRemote', input); } - async IsRemoteConfigured(): - Promise { return await this.SoapRequest('IsRemoteConfigured'); } + IsRemoteConfigured(): + Promise { return this.SoapRequest('IsRemoteConfigured'); } - async LearnIRCode(input: { IRCode: string; Timeout: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('LearnIRCode', input); } + LearnIRCode(input: { IRCode: string; Timeout: number }): + Promise { return this.SoapRequestWithBodyNoResponse('LearnIRCode', input); } - async SetIRRepeaterState(input: { DesiredIRRepeaterState: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetIRRepeaterState', input); } + SetIRRepeaterState(input: { DesiredIRRepeaterState: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetIRRepeaterState', input); } - async SetLEDFeedbackState(input: { LEDFeedbackState: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetLEDFeedbackState', input); } + SetLEDFeedbackState(input: { LEDFeedbackState: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetLEDFeedbackState', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/index.ts b/src/services/index.ts index 3c25661..e57a89c 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -2,7 +2,7 @@ * All sonos services exported as one file for easy access. * * Stephan van Rooij - * https://svrooij.io/sonos-api-docs + * https://sonos.svrooij.io/ * * This file is generated, do not edit manually. */ diff --git a/src/services/music-services.service.ts b/src/services/music-services.service.ts index f5a1152..6a65842 100644 --- a/src/services/music-services.service.ts +++ b/src/services/music-services.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,18 +29,18 @@ export class MusicServicesServiceBase extends BaseService { return await this.SoapRequestWithBody('GetSessionId', input); } + GetSessionId(input: { ServiceId: number; Username: string }): + Promise { return this.SoapRequestWithBody('GetSessionId', input); } /** * Load music service list as xml * @remarks Some libraries also support ListAndParseAvailableServices */ - async ListAvailableServices(): - Promise { return await this.SoapRequest('ListAvailableServices'); } + ListAvailableServices(): + Promise { return this.SoapRequest('ListAvailableServices'); } - async UpdateAvailableServices(): - Promise { return await this.SoapRequestNoResponse('UpdateAvailableServices'); } + UpdateAvailableServices(): + Promise { return this.SoapRequestNoResponse('UpdateAvailableServices'); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/q-play.service.ts b/src/services/q-play.service.ts index 3cabfa1..a2d3597 100644 --- a/src/services/q-play.service.ts +++ b/src/services/q-play.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,8 +29,8 @@ export class QPlayService extends BaseService { readonly errors: SonosUpnpError[] = SonosUpnpErrors.defaultErrors; // #region actions - async QPlayAuth(input: { Seed: string }): - Promise { return await this.SoapRequestWithBody('QPlayAuth', input); } + QPlayAuth(input: { Seed: string }): + Promise { return this.SoapRequestWithBody('QPlayAuth', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/queue.service.ts b/src/services/queue.service.ts index fcac6d2..0ca1992 100644 --- a/src/services/queue.service.ts +++ b/src/services/queue.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -32,38 +32,38 @@ export class QueueService extends BaseService { readonly errors: SonosUpnpError[] = SonosUpnpErrors.defaultErrors; // #region actions - async AddMultipleURIs(input: { QueueID: number; UpdateID: number; ContainerURI: string; ContainerMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean; NumberOfURIs: number; EnqueuedURIsAndMetaData: string }): - Promise { return await this.SoapRequestWithBody('AddMultipleURIs', input); } + AddMultipleURIs(input: { QueueID: number; UpdateID: number; ContainerURI: string; ContainerMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean; NumberOfURIs: number; EnqueuedURIsAndMetaData: string }): + Promise { return this.SoapRequestWithBody('AddMultipleURIs', input); } - async AddURI(input: { QueueID: number; UpdateID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): - Promise { return await this.SoapRequestWithBody('AddURI', input); } + AddURI(input: { QueueID: number; UpdateID: number; EnqueuedURI: string; EnqueuedURIMetaData: Track | string; DesiredFirstTrackNumberEnqueued: number; EnqueueAsNext: boolean }): + Promise { return this.SoapRequestWithBody('AddURI', input); } - async AttachQueue(input: { QueueOwnerID: string }): - Promise { return await this.SoapRequestWithBody('AttachQueue', input); } + AttachQueue(input: { QueueOwnerID: string }): + Promise { return this.SoapRequestWithBody('AttachQueue', input); } - async Backup(): - Promise { return await this.SoapRequestNoResponse('Backup'); } + Backup(): + Promise { return this.SoapRequestNoResponse('Backup'); } - async Browse(input: { QueueID: number; StartingIndex: number; RequestedCount: number }): - Promise { return await this.SoapRequestWithBody('Browse', input); } + Browse(input: { QueueID: number; StartingIndex: number; RequestedCount: number }): + Promise { return this.SoapRequestWithBody('Browse', input); } - async CreateQueue(input: { QueueOwnerID: string; QueueOwnerContext: string; QueuePolicy: string }): - Promise { return await this.SoapRequestWithBody('CreateQueue', input); } + CreateQueue(input: { QueueOwnerID: string; QueueOwnerContext: string; QueuePolicy: string }): + Promise { return this.SoapRequestWithBody('CreateQueue', input); } - async RemoveAllTracks(input: { QueueID: number; UpdateID: number }): - Promise { return await this.SoapRequestWithBody('RemoveAllTracks', input); } + RemoveAllTracks(input: { QueueID: number; UpdateID: number }): + Promise { return this.SoapRequestWithBody('RemoveAllTracks', input); } - async RemoveTrackRange(input: { QueueID: number; UpdateID: number; StartingIndex: number; NumberOfTracks: number }): - Promise { return await this.SoapRequestWithBody('RemoveTrackRange', input); } + RemoveTrackRange(input: { QueueID: number; UpdateID: number; StartingIndex: number; NumberOfTracks: number }): + Promise { return this.SoapRequestWithBody('RemoveTrackRange', input); } - async ReorderTracks(input: { QueueID: number; StartingIndex: number; NumberOfTracks: number; InsertBefore: number; UpdateID: number }): - Promise { return await this.SoapRequestWithBody('ReorderTracks', input); } + ReorderTracks(input: { QueueID: number; StartingIndex: number; NumberOfTracks: number; InsertBefore: number; UpdateID: number }): + Promise { return this.SoapRequestWithBody('ReorderTracks', input); } - async ReplaceAllTracks(input: { QueueID: number; UpdateID: number; ContainerURI: string; ContainerMetaData: Track | string; CurrentTrackIndex: number; NewCurrentTrackIndices: string; NumberOfURIs: number; EnqueuedURIsAndMetaData: string }): - Promise { return await this.SoapRequestWithBody('ReplaceAllTracks', input); } + ReplaceAllTracks(input: { QueueID: number; UpdateID: number; ContainerURI: string; ContainerMetaData: Track | string; CurrentTrackIndex: number; NewCurrentTrackIndices: string; NumberOfURIs: number; EnqueuedURIsAndMetaData: string }): + Promise { return this.SoapRequestWithBody('ReplaceAllTracks', input); } - async SaveAsSonosPlaylist(input: { QueueID: number; Title: string; ObjectID: string }): - Promise { return await this.SoapRequestWithBody('SaveAsSonosPlaylist', input); } + SaveAsSonosPlaylist(input: { QueueID: number; Title: string; ObjectID: string }): + Promise { return this.SoapRequestWithBody('SaveAsSonosPlaylist', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/rendering-control.service.ts b/src/services/rendering-control.service.ts index 0ecc6da..fdccbe1 100644 --- a/src/services/rendering-control.service.ts +++ b/src/services/rendering-control.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -37,8 +37,8 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBody('GetBass', input); } + GetBass(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetBass', input); } /** * Get equalizer value @@ -47,11 +47,11 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBody('GetEQ', input); } + GetEQ(input: { InstanceID: number; EQType: string }): + Promise { return this.SoapRequestWithBody('GetEQ', input); } - async GetHeadphoneConnected(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetHeadphoneConnected', input); } + GetHeadphoneConnected(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetHeadphoneConnected', input); } /** * Whether or not Loudness is on @@ -59,28 +59,28 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBody('GetLoudness', input); } + GetLoudness(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBody('GetLoudness', input); } - async GetMute(input: { InstanceID: number; Channel: string }): - Promise { return await this.SoapRequestWithBody('GetMute', input); } + GetMute(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBody('GetMute', input); } - async GetOutputFixed(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetOutputFixed', input); } + GetOutputFixed(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetOutputFixed', input); } - async GetRoomCalibrationStatus(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetRoomCalibrationStatus', input); } + GetRoomCalibrationStatus(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetRoomCalibrationStatus', input); } - async GetSupportsOutputFixed(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetSupportsOutputFixed', input); } + GetSupportsOutputFixed(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetSupportsOutputFixed', input); } /** * Get treble * * @param {number} input.InstanceID - InstanceID should always be `0` */ - async GetTreble(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('GetTreble', input); } + GetTreble(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('GetTreble', input); } /** * Get volume @@ -88,26 +88,26 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBody('GetVolume', input); } + GetVolume(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBody('GetVolume', input); } - async GetVolumeDB(input: { InstanceID: number; Channel: string }): - Promise { return await this.SoapRequestWithBody('GetVolumeDB', input); } + GetVolumeDB(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBody('GetVolumeDB', input); } - async GetVolumeDBRange(input: { InstanceID: number; Channel: string }): - Promise { return await this.SoapRequestWithBody('GetVolumeDBRange', input); } + GetVolumeDBRange(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBody('GetVolumeDBRange', input); } - async RampToVolume(input: { InstanceID: number; Channel: string; RampType: string; DesiredVolume: number; ResetVolumeAfter: boolean; ProgramURI: string }): - Promise { return await this.SoapRequestWithBody('RampToVolume', input); } + RampToVolume(input: { InstanceID: number; Channel: string; RampType: string; DesiredVolume: number; ResetVolumeAfter: boolean; ProgramURI: string }): + Promise { return this.SoapRequestWithBody('RampToVolume', input); } - async ResetBasicEQ(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBody('ResetBasicEQ', input); } + ResetBasicEQ(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBody('ResetBasicEQ', input); } - async ResetExtEQ(input: { InstanceID: number; EQType: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ResetExtEQ', input); } + ResetExtEQ(input: { InstanceID: number; EQType: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ResetExtEQ', input); } - async RestoreVolumePriorToRamp(input: { InstanceID: number; Channel: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RestoreVolumePriorToRamp', input); } + RestoreVolumePriorToRamp(input: { InstanceID: number; Channel: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RestoreVolumePriorToRamp', input); } /** * Set bass level, between -10 and 10 @@ -115,11 +115,11 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetBass', input); } + SetBass(input: { InstanceID: number; DesiredBass: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetBass', input); } - async SetChannelMap(input: { InstanceID: number; ChannelMap: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetChannelMap', input); } + SetChannelMap(input: { InstanceID: number; ChannelMap: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetChannelMap', input); } /** * Set equalizer value for different types @@ -129,8 +129,8 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetEQ', input); } + SetEQ(input: { InstanceID: number; EQType: string; DesiredValue: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetEQ', input); } /** * Set loudness on / off @@ -139,23 +139,23 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetLoudness', input); } + SetLoudness(input: { InstanceID: number; Channel: string; DesiredLoudness: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetLoudness', input); } - async SetMute(input: { InstanceID: number; Channel: string; DesiredMute: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetMute', input); } + SetMute(input: { InstanceID: number; Channel: string; DesiredMute: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetMute', input); } - async SetOutputFixed(input: { InstanceID: number; DesiredFixed: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetOutputFixed', input); } + SetOutputFixed(input: { InstanceID: number; DesiredFixed: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetOutputFixed', input); } - async SetRelativeVolume(input: { InstanceID: number; Channel: string; Adjustment: number }): - Promise { return await this.SoapRequestWithBody('SetRelativeVolume', input); } + SetRelativeVolume(input: { InstanceID: number; Channel: string; Adjustment: number }): + Promise { return this.SoapRequestWithBody('SetRelativeVolume', input); } - async SetRoomCalibrationStatus(input: { InstanceID: number; RoomCalibrationEnabled: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetRoomCalibrationStatus', input); } + SetRoomCalibrationStatus(input: { InstanceID: number; RoomCalibrationEnabled: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('SetRoomCalibrationStatus', input); } - async SetRoomCalibrationX(input: { InstanceID: number; CalibrationID: string; Coefficients: string; CalibrationMode: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetRoomCalibrationX', input); } + SetRoomCalibrationX(input: { InstanceID: number; CalibrationID: string; Coefficients: string; CalibrationMode: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetRoomCalibrationX', input); } /** * Set treble level @@ -163,14 +163,14 @@ export class RenderingControlServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetTreble', input); } + SetTreble(input: { InstanceID: number; DesiredTreble: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetTreble', input); } - async SetVolume(input: { InstanceID: number; Channel: string; DesiredVolume: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetVolume', input); } + SetVolume(input: { InstanceID: number; Channel: string; DesiredVolume: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetVolume', input); } - async SetVolumeDB(input: { InstanceID: number; Channel: string; DesiredVolume: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetVolumeDB', input); } + SetVolumeDB(input: { InstanceID: number; Channel: string; DesiredVolume: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetVolumeDB', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/sonos-upnp-errors.ts b/src/services/sonos-upnp-errors.ts index 7d5e955..207fac1 100644 --- a/src/services/sonos-upnp-errors.ts +++ b/src/services/sonos-upnp-errors.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import { SonosUpnpError } from '../models/sonos-upnp-error'; diff --git a/src/services/system-properties.service.ts b/src/services/system-properties.service.ts index 28a1687..0f2867f 100644 --- a/src/services/system-properties.service.ts +++ b/src/services/system-properties.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -29,26 +29,26 @@ export class SystemPropertiesServiceBase extends BaseService { return await this.SoapRequestWithBody('AddAccountX', input); } + AddAccountX(input: { AccountType: number; AccountID: string; AccountPassword: string }): + Promise { return this.SoapRequestWithBody('AddAccountX', input); } - async AddOAuthAccountX(input: { AccountType: number; AccountToken: string; AccountKey: string; OAuthDeviceID: string; AuthorizationCode: string; RedirectURI: string; UserIdHashCode: string; AccountTier: number }): - Promise { return await this.SoapRequestWithBody('AddOAuthAccountX', input); } + AddOAuthAccountX(input: { AccountType: number; AccountToken: string; AccountKey: string; OAuthDeviceID: string; AuthorizationCode: string; RedirectURI: string; UserIdHashCode: string; AccountTier: number }): + Promise { return this.SoapRequestWithBody('AddOAuthAccountX', input); } - async DoPostUpdateTasks(): - Promise { return await this.SoapRequestNoResponse('DoPostUpdateTasks'); } + DoPostUpdateTasks(): + Promise { return this.SoapRequestNoResponse('DoPostUpdateTasks'); } - async EditAccountMd(input: { AccountType: number; AccountID: string; NewAccountMd: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('EditAccountMd', input); } + EditAccountMd(input: { AccountType: number; AccountID: string; NewAccountMd: string }): + Promise { return this.SoapRequestWithBodyNoResponse('EditAccountMd', input); } - async EditAccountPasswordX(input: { AccountType: number; AccountID: string; NewAccountPassword: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('EditAccountPasswordX', input); } + EditAccountPasswordX(input: { AccountType: number; AccountID: string; NewAccountPassword: string }): + Promise { return this.SoapRequestWithBodyNoResponse('EditAccountPasswordX', input); } - async EnableRDM(input: { RDMValue: boolean }): - Promise { return await this.SoapRequestWithBodyNoResponse('EnableRDM', input); } + EnableRDM(input: { RDMValue: boolean }): + Promise { return this.SoapRequestWithBodyNoResponse('EnableRDM', input); } - async GetRDM(): - Promise { return await this.SoapRequest('GetRDM'); } + GetRDM(): + Promise { return this.SoapRequest('GetRDM'); } /** * Get a saved string. @@ -56,17 +56,17 @@ export class SystemPropertiesServiceBase extends BaseService { return await this.SoapRequestWithBody('GetString', input); } + GetString(input: { VariableName: string }): + Promise { return this.SoapRequestWithBody('GetString', input); } - async GetWebCode(input: { AccountType: number }): - Promise { return await this.SoapRequestWithBody('GetWebCode', input); } + GetWebCode(input: { AccountType: number }): + Promise { return this.SoapRequestWithBody('GetWebCode', input); } - async ProvisionCredentialedTrialAccountX(input: { AccountType: number; AccountID: string; AccountPassword: string }): - Promise { return await this.SoapRequestWithBody('ProvisionCredentialedTrialAccountX', input); } + ProvisionCredentialedTrialAccountX(input: { AccountType: number; AccountID: string; AccountPassword: string }): + Promise { return this.SoapRequestWithBody('ProvisionCredentialedTrialAccountX', input); } - async RefreshAccountCredentialsX(input: { AccountType: number; AccountUID: number; AccountToken: string; AccountKey: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RefreshAccountCredentialsX', input); } + RefreshAccountCredentialsX(input: { AccountType: number; AccountUID: number; AccountToken: string; AccountKey: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RefreshAccountCredentialsX', input); } /** * Remove a saved string @@ -74,20 +74,20 @@ export class SystemPropertiesServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('Remove', input); } + Remove(input: { VariableName: string }): + Promise { return this.SoapRequestWithBodyNoResponse('Remove', input); } - async RemoveAccount(input: { AccountType: number; AccountID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RemoveAccount', input); } + RemoveAccount(input: { AccountType: number; AccountID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RemoveAccount', input); } - async ReplaceAccountX(input: { AccountUDN: string; NewAccountID: string; NewAccountPassword: string; AccountToken: string; AccountKey: string; OAuthDeviceID: string }): - Promise { return await this.SoapRequestWithBody('ReplaceAccountX', input); } + ReplaceAccountX(input: { AccountUDN: string; NewAccountID: string; NewAccountPassword: string; AccountToken: string; AccountKey: string; OAuthDeviceID: string }): + Promise { return this.SoapRequestWithBody('ReplaceAccountX', input); } - async ResetThirdPartyCredentials(): - Promise { return await this.SoapRequestNoResponse('ResetThirdPartyCredentials'); } + ResetThirdPartyCredentials(): + Promise { return this.SoapRequestNoResponse('ResetThirdPartyCredentials'); } - async SetAccountNicknameX(input: { AccountUDN: string; AccountNickname: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetAccountNicknameX', input); } + SetAccountNicknameX(input: { AccountUDN: string; AccountNickname: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetAccountNicknameX', input); } /** * Save a string in the system @@ -96,8 +96,8 @@ export class SystemPropertiesServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('SetString', input); } + SetString(input: { VariableName: string; StringValue: string }): + Promise { return this.SoapRequestWithBodyNoResponse('SetString', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/virtual-line-in.service.ts b/src/services/virtual-line-in.service.ts index fad16b8..589fb53 100644 --- a/src/services/virtual-line-in.service.ts +++ b/src/services/virtual-line-in.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -25,29 +25,29 @@ export class VirtualLineInService extends BaseService readonly errors: SonosUpnpError[] = SonosUpnpErrors.defaultErrors; // #region actions - async Next(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Next', input); } + Next(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Next', input); } - async Pause(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Pause', input); } + Pause(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Pause', input); } - async Play(input: { InstanceID: number; Speed: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('Play', input); } + Play(input: { InstanceID: number; Speed: string }): + Promise { return this.SoapRequestWithBodyNoResponse('Play', input); } - async Previous(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Previous', input); } + Previous(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Previous', input); } - async SetVolume(input: { InstanceID: number; DesiredVolume: number }): - Promise { return await this.SoapRequestWithBodyNoResponse('SetVolume', input); } + SetVolume(input: { InstanceID: number; DesiredVolume: number }): + Promise { return this.SoapRequestWithBodyNoResponse('SetVolume', input); } - async StartTransmission(input: { InstanceID: number; CoordinatorID: string }): - Promise { return await this.SoapRequestWithBody('StartTransmission', input); } + StartTransmission(input: { InstanceID: number; CoordinatorID: string }): + Promise { return this.SoapRequestWithBody('StartTransmission', input); } - async Stop(input: { InstanceID: number } = { InstanceID: 0 }): - Promise { return await this.SoapRequestWithBodyNoResponse('Stop', input); } + Stop(input: { InstanceID: number } = { InstanceID: 0 }): + Promise { return this.SoapRequestWithBodyNoResponse('Stop', input); } - async StopTransmission(input: { InstanceID: number; CoordinatorID: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('StopTransmission', input); } + StopTransmission(input: { InstanceID: number; CoordinatorID: string }): + Promise { return this.SoapRequestWithBodyNoResponse('StopTransmission', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/services/zone-group-topology.service.ts b/src/services/zone-group-topology.service.ts index b524528..df1d13b 100644 --- a/src/services/zone-group-topology.service.ts +++ b/src/services/zone-group-topology.service.ts @@ -4,7 +4,7 @@ * Stephan van Rooij * https://svrooij.io * - * This file is generated, do not edit manually. https://svrooij.io/sonos-api-docs + * This file is generated, do not edit manually. https://sonos.svrooij.io/ */ import BaseService from './base-service'; import { SonosUpnpError } from '../models/sonos-upnp-error'; @@ -32,36 +32,36 @@ export class ZoneGroupTopologyServiceBase extends BaseService { return await this.SoapRequestWithBodyNoResponse('BeginSoftwareUpdate', input); } + BeginSoftwareUpdate(input: { UpdateURL: string; Flags: number; ExtraOptions: string }): + Promise { return this.SoapRequestWithBodyNoResponse('BeginSoftwareUpdate', input); } - async CheckForUpdate(input: { UpdateType: string; CachedOnly: boolean; Version: string }): - Promise { return await this.SoapRequestWithBody('CheckForUpdate', input); } + CheckForUpdate(input: { UpdateType: string; CachedOnly: boolean; Version: string }): + Promise { return this.SoapRequestWithBody('CheckForUpdate', input); } /** * Get information about the current Zone */ - async GetZoneGroupAttributes(): - Promise { return await this.SoapRequest('GetZoneGroupAttributes'); } + GetZoneGroupAttributes(): + Promise { return this.SoapRequest('GetZoneGroupAttributes'); } /** * Get all the Sonos groups, (as XML) * @remarks Some libraries also support GetParsedZoneGroupState that parses the xml for you. */ - async GetZoneGroupState(): - Promise { return await this.SoapRequest('GetZoneGroupState'); } + GetZoneGroupState(): + Promise { return this.SoapRequest('GetZoneGroupState'); } - async RegisterMobileDevice(input: { MobileDeviceName: string; MobileDeviceUDN: string; MobileIPAndPort: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('RegisterMobileDevice', input); } + RegisterMobileDevice(input: { MobileDeviceName: string; MobileDeviceUDN: string; MobileIPAndPort: string }): + Promise { return this.SoapRequestWithBodyNoResponse('RegisterMobileDevice', input); } - async ReportAlarmStartedRunning(): - Promise { return await this.SoapRequestNoResponse('ReportAlarmStartedRunning'); } + ReportAlarmStartedRunning(): + Promise { return this.SoapRequestNoResponse('ReportAlarmStartedRunning'); } - async ReportUnresponsiveDevice(input: { DeviceUUID: string; DesiredAction: string }): - Promise { return await this.SoapRequestWithBodyNoResponse('ReportUnresponsiveDevice', input); } + ReportUnresponsiveDevice(input: { DeviceUUID: string; DesiredAction: string }): + Promise { return this.SoapRequestWithBodyNoResponse('ReportUnresponsiveDevice', input); } - async SubmitDiagnostics(input: { IncludeControllers: boolean; Type: string }): - Promise { return await this.SoapRequestWithBody('SubmitDiagnostics', input); } + SubmitDiagnostics(input: { IncludeControllers: boolean; Type: string }): + Promise { return this.SoapRequestWithBody('SubmitDiagnostics', input); } // #endregion protected responseProperties(): { [key: string]: string } { diff --git a/src/sonos-device-base.ts b/src/sonos-device-base.ts index 555b537..7d5ac65 100644 --- a/src/sonos-device-base.ts +++ b/src/sonos-device-base.ts @@ -2,7 +2,7 @@ * Sonos base device with all services defined. * * Stephan van Rooij - * https://svrooij.io/sonos-api-docs + * https://sonos.svrooij.io/ * * This file is generated, do not edit manually. */ @@ -95,7 +95,7 @@ export default class SonosDeviceBase { private avtransportservice: AVTransportService | undefined; /** - * Service that controls stuff related to transport (play/pause/next/special urls) + * Service that controls stuff related to transport (play/pause/next/special URLs) * will be initialized on first use. * * @readonly diff --git a/src/sonos-device.ts b/src/sonos-device.ts index 212324e..3fefd35 100644 --- a/src/sonos-device.ts +++ b/src/sonos-device.ts @@ -1,7 +1,6 @@ import { EventEmitter } from 'events'; import TypedEmitter from 'typed-emitter'; import fetch from 'node-fetch'; -import WebSocket from 'ws'; import SonosDeviceBase from './sonos-device-base'; import { GetZoneInfoResponse, GetZoneAttributesResponse, AddURIToQueueResponse, AVTransportServiceEvent, RenderingControlServiceEvent, MusicService, AccountData, @@ -640,36 +639,33 @@ export default class SonosDevice extends SonosDeviceBase { if (options.volume !== undefined && (options.volume < 1 || options.volume > 100)) { throw new Error('Volume needs to be between 1 and 100'); } - - if (!this.uuid.startsWith('RINCON')) { - await this.LoadUuid(true); - } - + const previousValue = process.env.NODE_TLS_REJECT_UNAUTHORIZED; + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // Have no idea if this should be public // https://github.com/bencevans/node-sonos/issues/530#issuecomment-1430039043 const apiKey = '123e4567-e89b-12d3-a456-426655440000'; - return new Promise((resolve, reject) => { - const ws = new WebSocket(`wss://${this.host}:1443/websocket/api`, 'v1.api.smartspeaker.audio', { + const body = { + name: 'Sonos TS Notification', + appId: 'io.svrooij.sonos-ts', + streamUrl: options.trackUri, + volume: options.volume ?? this.volume ?? 25, + }; + + return fetch(`https://${this.host}:1443/api/v1/players/local/audioClip`, + { + method: 'POST', headers: { + 'Content-Type': 'application/json', 'X-Sonos-Api-Key': apiKey, }, - // Ignore certificate errors - rejectUnauthorized: false, - }); - ws.on('error', (err) => { - reject(err); - }); - // On socket opened send a message, and close the socket - ws.on('open', () => { - ws.send(`[{"namespace":"audioClip:1","command":"loadAudioClip","playerId":"${this.uuid}","sessionId":null,"cmdId":null},{"name": "Sonos TS Notification", "appId": "io.svrooij.sonos-ts", "streamUrl": "${options.trackUri}", "volume": ${options.volume ?? this.volume ?? 25} }]`, (err) => { - ws.close(); - if (err) { - reject(err); - return; - } - resolve(true); - }); - }); + body: JSON.stringify(body), + }).then((response) => { + if (response.ok) { + return true; + } + throw new Error(`Playing AudioClip failed ${response.status} ${response.statusText}`); + }).finally(() => { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = previousValue; }); }