twitchapon

[Twi]tch [Cha]nnel [Po]ints Rewards Redemption Listener
git clone git://bsandro.tech/twitchapon
Log | Files | Refs | README | LICENSE

commit 7cca70265d229614189f1b381ea310d7a47de4a8
parent 6f0e1b22e108da4db28cc2dac457521216fd4b15
Author: bsandro <[email protected]>
Date:   Sun, 15 Aug 2021 01:54:50 +0300

quick-n-dirty obs hookup with a goobs module (obs-websocket 4.x)

Diffstat:
Mapp/app.go | 9+++++++--
Mcmd/twitchapon/main.go | 8+++-----
Mconfig_sample.json | 2+-
Mgo.mod | 5++++-
Mgo.sum | 6++++++
Minterfaces/iapp.go | 2++
Dobs/client.go | 6------
Mtwitch/message.go | 12++++++++++--
Avendor/github.com/andreykaipov/goobs/.gitignore | 1+
Avendor/github.com/andreykaipov/goobs/LICENSE | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/Makefile | 12++++++++++++
Avendor/github.com/andreykaipov/goobs/README.md | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/events.go | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.broadcastcustommessage.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.heartbeat.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaended.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.medianext.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediapaused.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaplaying.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaprevious.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediarestarted.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastarted.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastopped.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.other.exiting.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilechanged.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilelistchanged.go | 18++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingpaused.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingresumed.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarted.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarting.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopped.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopping.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarted.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarting.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopped.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopping.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemadded.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemdeselected.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemlockchanged.go | 23+++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemremoved.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemselected.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemtransformchanged.go | 25+++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemvisibilitychanged.go | 23+++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sourceorderchanged.go | 24++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionchanged.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionlistchanged.go | 18++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.sceneschanged.go | 16++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.switchscenes.go | 19+++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudioactivated.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiodeactivated.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiomixerschanged.go | 27+++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiosyncoffsetchanged.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcecreated.go | 23+++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcedestroyed.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilteradded.go | 23+++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilterremoved.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltersreordered.go | 19+++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltervisibilitychanged.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcemutestatechanged.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcerenamed.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcevolumechanged.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarted.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarting.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstatus.go | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopped.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopping.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.previewscenechanged.go | 19+++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.studiomodeswitched.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.switchtransition.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionbegin.go | 27+++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitiondurationchanged.go | 14++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionend.go | 23+++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionlistchanged.go | 18++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionvideoend.go | 26++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstarted.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstopped.go | 11+++++++++++
Avendor/github.com/andreykaipov/goobs/api/events/zz_generated.events.go | 136+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/client.go | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.authenticate.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.broadcastcustommessage.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.executebatch.go | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getauthrequired.go | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getfilenameformatting.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getstats.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getversion.go | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getvideoinfo.go | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.openprojector.go | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.setfilenameformatting.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.sleep.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybyname.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybysequence.go | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/general/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediaduration.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediastate.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediatime.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.nextmedia.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.playpausemedia.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.previousmedia.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.restartmedia.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.scrubmedia.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.setmediatime.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.stopmedia.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/media_control/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.getoutputinfo.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.listoutputs.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.startoutput.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.stopoutput.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/outputs/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.getcurrentprofile.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.listprofiles.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.setcurrentprofile.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/profiles/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingfolder.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingstatus.go | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.pauserecording.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.resumerecording.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.setrecordingfolder.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startrecording.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startstoprecording.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.stoprecording.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/recording/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.getreplaybufferstatus.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.savereplaybuffer.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startreplaybuffer.go | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startstopreplaybuffer.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.stopreplaybuffer.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/requests.go | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.getcurrentscenecollection.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.listscenecollections.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.setcurrentscenecollection.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_collections/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.addsceneitem.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.deletesceneitem.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.duplicatesceneitem.go | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemlist.go | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemproperties.go | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.resetsceneitem.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemproperties.go | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemrender.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scene_items/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.createscene.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getcurrentscene.go | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenelist.go | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenetransitionoverride.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.removescenetransitionoverride.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.reordersceneitems.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setcurrentscene.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setscenetransitionoverride.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/scenes/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.addfiltertosource.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.createsource.go | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudioactive.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudiomonitortype.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmediasourceslist.go | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmute.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceactive.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcedefaultsettings.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilterinfo.go | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilters.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcesettings.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceslist.go | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcetypeslist.go | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getspecialsources.go | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsyncoffset.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextfreetype2properties.go | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextgdiplusproperties.go | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettracks.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getvolume.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.movesourcefilter.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.refreshbrowsersource.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.removefilterfromsource.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.reordersourcefilter.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setaudiomonitortype.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setmute.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltersettings.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltervisibility.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcename.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcesettings.go | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsyncoffset.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextfreetype2properties.go | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextgdiplusproperties.go | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settracks.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setvolume.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.takesourcescreenshot.go | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.togglemute.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/sources/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamingstatus.go | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamsettings.go | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.savestreamsettings.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.sendcaptions.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.setstreamsettings.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstopstreaming.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstreaming.go | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.stopstreaming.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/streaming/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.disablestudiomode.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.enablestudiomode.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getpreviewscene.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getstudiomodestatus.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.setpreviewscene.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.togglestudiomode.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.transitiontoprogram.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/studio_mode/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.getcurrenttransition.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionduration.go | 47+++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionlist.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionposition.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionsettings.go | 43+++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.releasetbar.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.setcurrenttransition.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settbarposition.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionduration.go | 40++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionsettings.go | 46++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/transitions/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.getvirtualcamstatus.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startstopvirtualcam.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startvirtualcam.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.stopvirtualcam.go | 44++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/zz_generated.client.go | 10++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/00_godoc.go | 12++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/bounds.go | 19+++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/crop.go | 20++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/filter.go | 16++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/font.go | 17+++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/item.go | 8++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/position.go | 15+++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/scale.go | 15+++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/stream_settings.go | 22++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.obsstats.go | 33+++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.output.go | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scene.go | 12++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitem.go | 48++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitemtransform.go | 45+++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scenescollection.go | 9+++++++++
Avendor/github.com/andreykaipov/goobs/client.go | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/andreykaipov/goobs/go.mod | 8++++++++
Avendor/github.com/andreykaipov/goobs/go.sum | 4++++
Avendor/github.com/andreykaipov/goobs/zz_generated.client.go | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/.gitignore | 25+++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/AUTHORS | 9+++++++++
Avendor/github.com/gorilla/websocket/LICENSE | 22++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/README.md | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/client.go | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/client_clone.go | 16++++++++++++++++
Avendor/github.com/gorilla/websocket/client_clone_legacy.go | 38++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/compression.go | 148+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/conn.go | 1201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/conn_write.go | 15+++++++++++++++
Avendor/github.com/gorilla/websocket/conn_write_legacy.go | 18++++++++++++++++++
Avendor/github.com/gorilla/websocket/doc.go | 227+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/go.mod | 3+++
Avendor/github.com/gorilla/websocket/go.sum | 0
Avendor/github.com/gorilla/websocket/join.go | 42++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/json.go | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/mask.go | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/mask_safe.go | 15+++++++++++++++
Avendor/github.com/gorilla/websocket/prepared.go | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/proxy.go | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/server.go | 363+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/trace.go | 19+++++++++++++++++++
Avendor/github.com/gorilla/websocket/trace_17.go | 12++++++++++++
Avendor/github.com/gorilla/websocket/util.go | 283+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/gorilla/websocket/x_net_proxy.go | 473+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avendor/github.com/nu7hatch/gouuid/.gitignore | 11+++++++++++
Avendor/github.com/nu7hatch/gouuid/COPYING | 20++++++++++++++++++++
Avendor/github.com/nu7hatch/gouuid/README.md | 21+++++++++++++++++++++
Avendor/github.com/nu7hatch/gouuid/uuid.go | 173+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mvendor/modules.txt | 24++++++++++++++++++++++++
269 files changed, 12868 insertions(+), 17 deletions(-)

diff --git a/app/app.go b/app/app.go @@ -4,6 +4,7 @@ import ( "bsandro.tech/git/twitchapon/config" "bsandro.tech/git/twitchapon/localserver" "bsandro.tech/git/twitchapon/twitch" + "github.com/andreykaipov/goobs" "golang.org/x/net/websocket" "log" "net/http" @@ -13,7 +14,7 @@ import ( type TApp struct { Connection *websocket.Conn - Obs *websocket.Conn + Obs *goobs.Client WaitGroup sync.WaitGroup Config config.TConfig User *twitch.TUser @@ -37,6 +38,10 @@ func (app *TApp) GetConnection() *websocket.Conn { return app.Connection } +func (app *TApp) GetObs() *goobs.Client { + return app.Obs +} + func (app *TApp) InitConfig() error { if app.Config.IsInited() { return nil @@ -92,7 +97,7 @@ func (app *TApp) ListenJob() { if msg.Type == "RESPONSE" { twitch.ProcessResponse(&msg) } else if msg.Type == "MESSAGE" { - twitch.ProcessMessage(&msg) + twitch.ProcessMessage(app, &msg) } } diff --git a/cmd/twitchapon/main.go b/cmd/twitchapon/main.go @@ -3,6 +3,7 @@ package main import ( App "bsandro.tech/git/twitchapon/app" "fmt" + "github.com/andreykaipov/goobs" "golang.org/x/net/websocket" "log" ) @@ -12,10 +13,6 @@ func CloseConnections(app *App.TApp) { app.Connection.Close() app.Connection = nil } - if app.Obs != nil { - app.Obs.Close() - app.Obs = nil - } } func main() { @@ -33,7 +30,8 @@ func main() { if err != nil { log.Fatal(err) } - app.Obs, err = websocket.Dial(fmt.Sprintf("wss://%s:%s/", app.Config.Obs.Host, app.Config.Obs.Port), "", "http://localhost") + + app.Obs, err = goobs.New(fmt.Sprintf("%s:%s", app.Config.Obs.Host, app.Config.Obs.Port), goobs.WithPassword(app.Config.Obs.Password)) if err != nil { log.Fatal(err) } diff --git a/config_sample.json b/config_sample.json @@ -6,7 +6,7 @@ "client_secret": "zzzzzzzzzzzzzzzzzzzzzzzzzzzz" }, "obs": { - "host": "127.0.0.1", + "host": "localhost", "port": "4444", "password": "xxxxxxxx" } diff --git a/go.mod b/go.mod @@ -2,4 +2,7 @@ module bsandro.tech/git/twitchapon go 1.16 -require golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 +require ( + github.com/andreykaipov/goobs v0.6.0 + golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 +) diff --git a/go.sum b/go.sum @@ -1,3 +1,9 @@ +github.com/andreykaipov/goobs v0.6.0 h1:qTZBh8fw9HlwfqdLKAWUGhgPsPSiGEosQNrBFmlQPm0= +github.com/andreykaipov/goobs v0.6.0/go.mod h1:PsbaqYzrYfbPcXhzI/VltZRekmU8cw3ydCGvFYaUFZA= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/interfaces/iapp.go b/interfaces/iapp.go @@ -1,6 +1,7 @@ package twitchapon import ( + "github.com/andreykaipov/goobs" "golang.org/x/net/websocket" ) @@ -15,4 +16,5 @@ type IApp interface { GetAccessToken() string GetUserId() string GetConnection() *websocket.Conn + GetObs() *goobs.Client } diff --git a/obs/client.go b/obs/client.go @@ -1,6 +0,0 @@ -package twitchapon - -import ( - _ "fmt" - _ "golang.org/x/net/websocket" -) diff --git a/twitch/message.go b/twitch/message.go @@ -1,8 +1,10 @@ package twitch import ( + iface "bsandro.tech/git/twitchapon/interfaces" "encoding/json" "fmt" + "github.com/andreykaipov/goobs/api/requests/media_control" ) type TChannelPointsMessage struct { @@ -52,12 +54,18 @@ type TChannelPointsMessage struct { } `json:"data"` } -func ProcessMessage(msg *TMessage) { +func ProcessMessage(app iface.IApp, msg *TMessage) { fmt.Println("Got valid message:", msg.Data.Message) var chanPointsMsg TChannelPointsMessage if err := json.Unmarshal([]byte(msg.Data.Message), &chanPointsMsg); err != nil { fmt.Println("Json parse error", err) } else { - fmt.Println("Json parse ok") + if chanPointsMsg.MsgType == "reward-redeemed" { + title := chanPointsMsg.Data.Redemption.Reward.Title + if title == "Tutturu!" || title == "Selamat Pagi!" { + fmt.Printf("playing sound %s\n", title) + _, _ = app.GetObs().MediaControl.RestartMedia(&mediacontrol.RestartMediaParams{SourceName: title}) + } + } } } diff --git a/vendor/github.com/andreykaipov/goobs/.gitignore b/vendor/github.com/andreykaipov/goobs/.gitignore @@ -0,0 +1 @@ +internal/bin diff --git a/vendor/github.com/andreykaipov/goobs/LICENSE b/vendor/github.com/andreykaipov/goobs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/andreykaipov/goobs/Makefile b/vendor/github.com/andreykaipov/goobs/Makefile @@ -0,0 +1,12 @@ +test: + cd internal; go test -v -count 1 ./... + +generate: clean + cd internal; go run ./comments/ + cd internal; go build -o bin/ github.com/segmentio/golines + ./internal/bin/golines --shorten-comments --max-len=120 --reformat-tags --write-output api + +clean: + find . -name '*_generated.*.go' -exec rm -f {} \; + find . -type d -empty -delete + find . -type d -name bin -prune -exec rm -rf {} \; diff --git a/vendor/github.com/andreykaipov/goobs/README.md b/vendor/github.com/andreykaipov/goobs/README.md @@ -0,0 +1,115 @@ +# goobs + +[![Go +Reference](https://pkg.go.dev/badge/github.com/andreykaipov/goobs.svg)](https://pkg.go.dev/github.com/andreykaipov/goobs) + +It's a Go client for +[Palakis/obs-websocket](https://github.com/Palakis/obs-websocket), allowing us +to interact with OBS Studio via Go. + +## installation + +To add this client library to your module, simply `go get` it like any other Go +module after you've initialized your own: + +```console +❯ go mod init blah +❯ go get github.com/andreykaipov/goobs +``` + +The latest release is v0.6.0 for [v4.9.1 of the obs-websocket +protocol](https://github.com/Palakis/obs-websocket/blob/4.9.1/docs/generated/protocol.md). + +## usage + +Usage is best demonstrated via a (hopefully self-explanatory) example. Here's +[examples/sources/main.go](examples/sources/main.go), showing off how we can +asynchronously listen for events, or send/receive synchronous +requests/responses, and how the two interact. + +For brevity, error checks in a few places are omitted: + +```go +package main + +import ... + +func main() { + client, err := goobs.New(os.Getenv("WSL_HOST")+":4444", goobs.WithPassword("hello")) + if err != nil { + panic(err) + } + + go func() { + for event := range client.IncomingEvents { + switch e := event.(type) { + case *events.SourceVolumeChanged: + fmt.Printf("Volume changed for %-25q: %f\n", e.SourceName, e.Volume) + default: + log.Printf("Unhandled event: %#v", e.GetUpdateType()) + } + } + }() + + fmt.Println("Setting random volumes for each source...") + + rand.Seed(time.Now().UnixNano()) + list, _ := client.Sources.GetSourcesList() + + for _, v := range list.Sources { + if _, err := client.Sources.SetVolume(&sources.SetVolumeParams{ + Source: v.Name, + Volume: rand.Float64(), + }); err != nil { + panic(err) + } + } + + fmt.Println("Test toggling the mute status of the first source...") + + name := list.Sources[0].Name + resp, _ := client.Sources.GetVolume(&sources.GetVolumeParams{Source: name}) + fmt.Printf("%s is muted? %t\n", name, resp.Muted) + + _, _ = client.Sources.ToggleMute(&sources.ToggleMuteParams{Source: name}) + resp, _ = client.Sources.GetVolume(&sources.GetVolumeParams{Source: name}) + fmt.Printf("%s is muted? %t\n", name, resp.Muted) +} +``` + +And the corresponding output: + +```console +❯ go run examples/sources/main.go +2021/06/14 02:22:18 connecting to ws://172.28.208.1:4444 +Setting random volumes for each source... +Volume changed for "Chat" : 0.272767 +Volume changed for "Window Capture" : 0.791386 +Volume changed for "Audio Output Capture" : 0.777533 +Volume changed for "Video Capture Device" : 0.084827 +Volume changed for "Mic/Aux" : 0.104773 +Volume changed for "Desktop Audio" : 0.997565 +Test toggling the mute status of the first source... +Chat is muted? false +2021/06/14 02:22:18 Unhandled event: "SourceMuteStateChanged" +Chat is muted? true +``` + +## development + +This client is generated from the mess inside `./internal/comments`, reading the +[comments.json](https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/comments.json) +file found in [Palakis/obs-websocket](https://github.com/Palakis/obs-websocket). + +Apart from `internal`, the only other hand-written code are the following files: + +```console +❯ find *.go api/ -not -name '*_generated.*.go' -name '*.go' +client.go +api/requests/client.go +api/requests/requests.go +api/events/events.go +``` + +Iteration involves changing the generative code, running `make generate`, and +making sure the examples still work. diff --git a/vendor/github.com/andreykaipov/goobs/api/events/events.go b/vendor/github.com/andreykaipov/goobs/api/events/events.go @@ -0,0 +1,83 @@ +package events + +import ( + "encoding/json" + "fmt" +) + +// Event describes the behavior of any event. Used to abstract the functionality +// of any event that embeds EventBasic within their fields. +type Event interface { + GetUpdateType() string + GetStreamTimecode() string + GetRecordingTimecode() string +} + +// EventBasic represents the common fields of any event. +type EventBasic struct { + // The name of the event. + UpdateType string `json:"update-type,omitempty"` + + // Time elapsed between now and stream start (only present if OBS Studio + // is streaming). Timecodes in format `HH:MM:SS.mmm`. + StreamTimecode string `json:"stream-timecode,omitempty"` + + // Time elapsed between now and recording start (only present if OBS + // Studio is recording). Timecodes in format `HH:MM:SS.mmm`. + RecordingTimecode string `json:"rec-timecode,omitempty"` +} + +// GetUpdateType does what it says. +func (e *EventBasic) GetUpdateType() string { + return e.UpdateType +} + +// GetStreamTimecode does what it says. +func (e *EventBasic) GetStreamTimecode() string { + return e.StreamTimecode +} + +// GetRecordingTimecode does what says. +func (e *EventBasic) GetRecordingTimecode() string { + return e.RecordingTimecode +} + +// Error is used to wrap any errors we might encounter in our eventing loop. +type Error struct { + EventBasic + Err error +} + +// WrapError takes an error and wraps it in our custom Error event. +func WrapError(err error) *Error { + return &Error{ + EventBasic{UpdateType: "Error"}, + err, + } +} + +// Parse takes a raw JSON message, figures out its type, and returns an event. +func Parse(raw json.RawMessage) (Event, error) { + unknownEvent := &EventBasic{} + if err := json.Unmarshal(raw, unknownEvent); err != nil { + return nil, fmt.Errorf("Couldn't unmarshal %s into an unknown event: %s", raw, err) + } + + eventType := unknownEvent.UpdateType + + switch knownEvent := GetEventForType(eventType); knownEvent { + case nil: + return unknownEvent, nil + default: + if err := json.Unmarshal(raw, knownEvent); err != nil { + return nil, fmt.Errorf( + "Couldn't unmarshal %s into an event type of %q: %s", + raw, + eventType, + err, + ) + } + + return knownEvent, nil + } +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.broadcastcustommessage.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.broadcastcustommessage.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +BroadcastCustomMessage represents the event body for the "BroadcastCustomMessage" event. +Since v4.7.0. +*/ +type BroadcastCustomMessage struct { + EventBasic + + // User-defined data + Data map[string]interface{} `json:"data,omitempty"` + + // Identifier provided by the sender + Realm string `json:"realm,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.heartbeat.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.general.heartbeat.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +Heartbeat represents the event body for the "Heartbeat" event. +Since vv0.3. +*/ +type Heartbeat struct { + EventBasic + + // Current active profile. + CurrentProfile string `json:"current-profile,omitempty"` + + // Current active scene. + CurrentScene string `json:"current-scene,omitempty"` + + // Toggles between every JSON message as an "I am alive" indicator. + Pulse bool `json:"pulse"` + + // Current recording state. + Recording bool `json:"recording"` + + // OBS Stats + Stats typedefs.OBSStats `json:"stats,omitempty"` + + // Current streaming state. + Streaming bool `json:"streaming"` + + // Total bytes recorded since the recording started. + TotalRecordBytes int `json:"total-record-bytes,omitempty"` + + // Total frames recorded since the recording started. + TotalRecordFrames int `json:"total-record-frames,omitempty"` + + // Total time (in seconds) since recording started. + TotalRecordTime int `json:"total-record-time,omitempty"` + + // Total bytes sent since the stream started. + TotalStreamBytes int `json:"total-stream-bytes,omitempty"` + + // Total frames streamed since the stream started. + TotalStreamFrames int `json:"total-stream-frames,omitempty"` + + // Total time (in seconds) since the stream started. + TotalStreamTime int `json:"total-stream-time,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaended.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaended.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaEnded represents the event body for the "MediaEnded" event. +Since v4.9.0. +*/ +type MediaEnded struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.medianext.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.medianext.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaNext represents the event body for the "MediaNext" event. +Since v4.9.0. +*/ +type MediaNext struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediapaused.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediapaused.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaPaused represents the event body for the "MediaPaused" event. +Since v4.9.0. +*/ +type MediaPaused struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaplaying.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaplaying.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaPlaying represents the event body for the "MediaPlaying" event. +Since v4.9.0. +*/ +type MediaPlaying struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaprevious.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediaprevious.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaPrevious represents the event body for the "MediaPrevious" event. +Since v4.9.0. +*/ +type MediaPrevious struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediarestarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediarestarted.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaRestarted represents the event body for the "MediaRestarted" event. +Since v4.9.0. +*/ +type MediaRestarted struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastarted.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaStarted represents the event body for the "MediaStarted" event. +Since v4.9.0. +*/ +type MediaStarted struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastopped.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.media.mediastopped.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +MediaStopped represents the event body for the "MediaStopped" event. +Since v4.9.0. +*/ +type MediaStopped struct { + EventBasic + + // The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.other.exiting.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.other.exiting.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +Exiting represents the event body for the "Exiting" event. +Since v0.3. +*/ +type Exiting struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilechanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilechanged.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ProfileChanged represents the event body for the "ProfileChanged" event. +Since v4.0.0. +*/ +type ProfileChanged struct { + EventBasic + + // Name of the new current profile. + Profile string `json:"profile,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilelistchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.profiles.profilelistchanged.go @@ -0,0 +1,18 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ProfileListChanged represents the event body for the "ProfileListChanged" event. +Since v4.0.0. +*/ +type ProfileListChanged struct { + EventBasic + + Profiles []*Profile `json:"profiles,omitempty"` +} + +type Profile struct { + // Profile name. + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingpaused.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingpaused.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingPaused represents the event body for the "RecordingPaused" event. +Since v4.7.0. +*/ +type RecordingPaused struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingresumed.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingresumed.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingResumed represents the event body for the "RecordingResumed" event. +Since v4.7.0. +*/ +type RecordingResumed struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarted.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingStarted represents the event body for the "RecordingStarted" event. +Since v0.3. +*/ +type RecordingStarted struct { + EventBasic + + // Absolute path to the file of the current recording. + RecordingFilename string `json:"recordingFilename,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarting.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstarting.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingStarting represents the event body for the "RecordingStarting" event. +Since v0.3. +*/ +type RecordingStarting struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopped.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopped.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingStopped represents the event body for the "RecordingStopped" event. +Since v0.3. +*/ +type RecordingStopped struct { + EventBasic + + // Absolute path to the file of the current recording. + RecordingFilename string `json:"recordingFilename,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopping.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.recording.recordingstopping.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +RecordingStopping represents the event body for the "RecordingStopping" event. +Since v0.3. +*/ +type RecordingStopping struct { + EventBasic + + // Absolute path to the file of the current recording. + RecordingFilename string `json:"recordingFilename,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarted.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ReplayStarted represents the event body for the "ReplayStarted" event. +Since v4.2.0. +*/ +type ReplayStarted struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarting.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystarting.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ReplayStarting represents the event body for the "ReplayStarting" event. +Since v4.2.0. +*/ +type ReplayStarting struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopped.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopped.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ReplayStopped represents the event body for the "ReplayStopped" event. +Since v4.2.0. +*/ +type ReplayStopped struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopping.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.replay_buffer.replaystopping.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +ReplayStopping represents the event body for the "ReplayStopping" event. +Since v4.2.0. +*/ +type ReplayStopping struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemadded.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemadded.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemAdded represents the event body for the "SceneItemAdded" event. +Since v4.0.0. +*/ +type SceneItemAdded struct { + EventBasic + + // Scene item ID + ItemId int `json:"item-id,omitempty"` + + // Name of the item added to the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemdeselected.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemdeselected.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemDeselected represents the event body for the "SceneItemDeselected" event. +Since v4.6.0. +*/ +type SceneItemDeselected struct { + EventBasic + + // Name of the item in the scene. + ItemId int `json:"item-id,omitempty"` + + // Name of the item in the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemlockchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemlockchanged.go @@ -0,0 +1,23 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemLockChanged represents the event body for the "SceneItemLockChanged" event. +Since v4.8.0. +*/ +type SceneItemLockChanged struct { + EventBasic + + // Scene item ID + ItemId int `json:"item-id,omitempty"` + + // New locked state of the item. + ItemLocked bool `json:"item-locked"` + + // Name of the item in the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemremoved.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemremoved.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemRemoved represents the event body for the "SceneItemRemoved" event. +Since v4.0.0. +*/ +type SceneItemRemoved struct { + EventBasic + + // Scene item ID + ItemId int `json:"item-id,omitempty"` + + // Name of the item removed from the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemselected.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemselected.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemSelected represents the event body for the "SceneItemSelected" event. +Since v4.6.0. +*/ +type SceneItemSelected struct { + EventBasic + + // Name of the item in the scene. + ItemId int `json:"item-id,omitempty"` + + // Name of the item in the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemtransformchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemtransformchanged.go @@ -0,0 +1,25 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +SceneItemTransformChanged represents the event body for the "SceneItemTransformChanged" event. +Since v4.6.0. +*/ +type SceneItemTransformChanged struct { + EventBasic + + // Scene item ID + ItemId int `json:"item-id,omitempty"` + + // Name of the item in the scene. + ItemName string `json:"item-name,omitempty"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` + + // Scene item transform properties + Transform typedefs.SceneItemTransform `json:"transform,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemvisibilitychanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sceneitemvisibilitychanged.go @@ -0,0 +1,23 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneItemVisibilityChanged represents the event body for the "SceneItemVisibilityChanged" event. +Since v4.0.0. +*/ +type SceneItemVisibilityChanged struct { + EventBasic + + // Scene item ID + ItemId int `json:"item-id,omitempty"` + + // Name of the item in the scene. + ItemName string `json:"item-name,omitempty"` + + // New visibility state of the item. + ItemVisible bool `json:"item-visible"` + + // Name of the scene. + SceneName string `json:"scene-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sourceorderchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scene_items.sourceorderchanged.go @@ -0,0 +1,24 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceOrderChanged represents the event body for the "SourceOrderChanged" event. +Since v4.0.0. +*/ +type SourceOrderChanged struct { + EventBasic + + SceneItems []*SceneItem `json:"scene-items,omitempty"` + + // Name of the scene where items have been reordered. + SceneName string `json:"scene-name,omitempty"` +} + +type SceneItem struct { + // Scene item unique ID + ItemId int `json:"item-id,omitempty"` + + // Item source name + SourceName string `json:"source-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionchanged.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneCollectionChanged represents the event body for the "SceneCollectionChanged" event. +Since v4.0.0. +*/ +type SceneCollectionChanged struct { + EventBasic + + // Name of the new current scene collection. + SceneCollection string `json:"sceneCollection,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionlistchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.scenecollectionlistchanged.go @@ -0,0 +1,18 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SceneCollectionListChanged represents the event body for the "SceneCollectionListChanged" event. +Since v4.0.0. +*/ +type SceneCollectionListChanged struct { + EventBasic + + SceneCollections []*SceneCollection `json:"sceneCollections,omitempty"` +} + +type SceneCollection struct { + // Scene collection name. + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.sceneschanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.sceneschanged.go @@ -0,0 +1,16 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +ScenesChanged represents the event body for the "ScenesChanged" event. +Since v0.3. +*/ +type ScenesChanged struct { + EventBasic + + // Scenes list. + Scenes []typedefs.Scene `json:"scenes,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.switchscenes.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.scenes.switchscenes.go @@ -0,0 +1,19 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +SwitchScenes represents the event body for the "SwitchScenes" event. +Since v0.3. +*/ +type SwitchScenes struct { + EventBasic + + // The new scene. + SceneName string `json:"scene-name,omitempty"` + + // List of scene items in the new scene. Same specification as [`GetCurrentScene`](#getcurrentscene). + Sources []typedefs.SceneItem `json:"sources,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudioactivated.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudioactivated.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceAudioActivated represents the event body for the "SourceAudioActivated" event. +Since v4.9.0. +*/ +type SourceAudioActivated struct { + EventBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiodeactivated.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiodeactivated.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceAudioDeactivated represents the event body for the "SourceAudioDeactivated" event. +Since v4.9.0. +*/ +type SourceAudioDeactivated struct { + EventBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiomixerschanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiomixerschanged.go @@ -0,0 +1,27 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceAudioMixersChanged represents the event body for the "SourceAudioMixersChanged" event. +Since v4.6.0. +*/ +type SourceAudioMixersChanged struct { + EventBasic + + // Raw mixer flags (little-endian, one bit per mixer) as an hexadecimal value + HexMixersValue string `json:"hexMixersValue,omitempty"` + + Mixers []*Mixer `json:"mixers,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} + +type Mixer struct { + // Routing status + Enabled bool `json:"enabled"` + + // Mixer number + Id int `json:"id,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiosyncoffsetchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourceaudiosyncoffsetchanged.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceAudioSyncOffsetChanged represents the event body for the "SourceAudioSyncOffsetChanged" event. +Since v4.6.0. +*/ +type SourceAudioSyncOffsetChanged struct { + EventBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Audio sync offset of the source (in nanoseconds) + SyncOffset int `json:"syncOffset,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcecreated.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcecreated.go @@ -0,0 +1,23 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceCreated represents the event body for the "SourceCreated" event. +Since v4.6.0. +*/ +type SourceCreated struct { + EventBasic + + // Source kind. + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Source settings + SourceSettings map[string]interface{} `json:"sourceSettings,omitempty"` + + // Source type. Can be "input", "scene", "transition" or "filter". + SourceType string `json:"sourceType,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcedestroyed.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcedestroyed.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceDestroyed represents the event body for the "SourceDestroyed" event. +Since v4.6.0. +*/ +type SourceDestroyed struct { + EventBasic + + // Source kind. + SourceKind string `json:"sourceKind,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Source type. Can be "input", "scene", "transition" or "filter". + SourceType string `json:"sourceType,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilteradded.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilteradded.go @@ -0,0 +1,23 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceFilterAdded represents the event body for the "SourceFilterAdded" event. +Since v4.6.0. +*/ +type SourceFilterAdded struct { + EventBasic + + // Filter name + FilterName string `json:"filterName,omitempty"` + + // Filter settings + FilterSettings map[string]interface{} `json:"filterSettings,omitempty"` + + // Filter type + FilterType string `json:"filterType,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilterremoved.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefilterremoved.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceFilterRemoved represents the event body for the "SourceFilterRemoved" event. +Since v4.6.0. +*/ +type SourceFilterRemoved struct { + EventBasic + + // Filter name + FilterName string `json:"filterName,omitempty"` + + // Filter type + FilterType string `json:"filterType,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltersreordered.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltersreordered.go @@ -0,0 +1,19 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +SourceFiltersReordered represents the event body for the "SourceFiltersReordered" event. +Since v4.6.0. +*/ +type SourceFiltersReordered struct { + EventBasic + + // The filters for this object. + Filters []*typedefs.Filter `json:"filters,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltervisibilitychanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcefiltervisibilitychanged.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceFilterVisibilityChanged represents the event body for the "SourceFilterVisibilityChanged" event. +Since v4.7.0. +*/ +type SourceFilterVisibilityChanged struct { + EventBasic + + // New filter state + FilterEnabled bool `json:"filterEnabled"` + + // Filter name + FilterName string `json:"filterName,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcemutestatechanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcemutestatechanged.go @@ -0,0 +1,17 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceMuteStateChanged represents the event body for the "SourceMuteStateChanged" event. +Since v4.6.0. +*/ +type SourceMuteStateChanged struct { + EventBasic + + // Mute status of the source + Muted bool `json:"muted"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcerenamed.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcerenamed.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceRenamed represents the event body for the "SourceRenamed" event. +Since v4.6.0. +*/ +type SourceRenamed struct { + EventBasic + + // New source name + NewName string `json:"newName,omitempty"` + + // Previous source name + PreviousName string `json:"previousName,omitempty"` + + // Type of source (input, scene, filter, transition) + SourceType string `json:"sourceType,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcevolumechanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.sources.sourcevolumechanged.go @@ -0,0 +1,20 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SourceVolumeChanged represents the event body for the "SourceVolumeChanged" event. +Since v4.6.0. +*/ +type SourceVolumeChanged struct { + EventBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Source volume + Volume float64 `json:"volume,omitempty"` + + // Source volume in Decibel + VolumeDb float64 `json:"volumeDb,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarted.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StreamStarted represents the event body for the "StreamStarted" event. +Since v0.3. +*/ +type StreamStarted struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarting.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstarting.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StreamStarting represents the event body for the "StreamStarting" event. +Since v0.3. +*/ +type StreamStarting struct { + EventBasic + + // Always false (retrocompatibility). + PreviewOnly bool `json:"preview-only"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstatus.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstatus.go @@ -0,0 +1,68 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StreamStatus represents the event body for the "StreamStatus" event. +Since v0.3. +*/ +type StreamStatus struct { + EventBasic + + // Average frame time (in milliseconds) + AverageFrameTime float64 `json:"average-frame-time,omitempty"` + + // Amount of data per second (in bytes) transmitted by the stream encoder. + BytesPerSec int `json:"bytes-per-sec,omitempty"` + + // Current CPU usage (percentage) + CpuUsage float64 `json:"cpu-usage,omitempty"` + + // Current framerate. + Fps float64 `json:"fps,omitempty"` + + // Free recording disk space (in megabytes) + FreeDiskSpace float64 `json:"free-disk-space,omitempty"` + + // Amount of data per second (in kilobits) transmitted by the stream encoder. + KbitsPerSec int `json:"kbits-per-sec,omitempty"` + + // Current RAM usage (in megabytes) + MemoryUsage float64 `json:"memory-usage,omitempty"` + + // Number of frames dropped by the encoder since the stream started. + NumDroppedFrames int `json:"num-dropped-frames,omitempty"` + + // Total number of frames transmitted since the stream started. + NumTotalFrames int `json:"num-total-frames,omitempty"` + + // Number of frames skipped due to encoding lag + OutputSkippedFrames int `json:"output-skipped-frames,omitempty"` + + // Number of frames outputted + OutputTotalFrames int `json:"output-total-frames,omitempty"` + + // Always false (retrocompatibility). + PreviewOnly bool `json:"preview-only"` + + // Current recording state. + Recording bool `json:"recording"` + + // Number of frames missed due to rendering lag + RenderMissedFrames int `json:"render-missed-frames,omitempty"` + + // Number of frames rendered + RenderTotalFrames int `json:"render-total-frames,omitempty"` + + // Replay Buffer status + ReplayBufferActive bool `json:"replay-buffer-active"` + + // Percentage of dropped frames. + Strain float64 `json:"strain,omitempty"` + + // Current streaming state. + Streaming bool `json:"streaming"` + + // Total time (in seconds) since the stream started. + TotalStreamTime int `json:"total-stream-time,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopped.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopped.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StreamStopped represents the event body for the "StreamStopped" event. +Since v0.3. +*/ +type StreamStopped struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopping.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.streaming.streamstopping.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StreamStopping represents the event body for the "StreamStopping" event. +Since v0.3. +*/ +type StreamStopping struct { + EventBasic + + // Always false (retrocompatibility). + PreviewOnly bool `json:"preview-only"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.previewscenechanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.previewscenechanged.go @@ -0,0 +1,19 @@ +// This file has been automatically generated. Don't edit it. + +package events + +import typedefs "github.com/andreykaipov/goobs/api/typedefs" + +/* +PreviewSceneChanged represents the event body for the "PreviewSceneChanged" event. +Since v4.1.0. +*/ +type PreviewSceneChanged struct { + EventBasic + + // Name of the scene being previewed. + SceneName string `json:"scene-name,omitempty"` + + // List of sources composing the scene. Same specification as [`GetCurrentScene`](#getcurrentscene). + Sources []typedefs.SceneItem `json:"sources,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.studiomodeswitched.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.studio_mode.studiomodeswitched.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +StudioModeSwitched represents the event body for the "StudioModeSwitched" event. +Since v4.1.0. +*/ +type StudioModeSwitched struct { + EventBasic + + // The new enabled state of Studio Mode. + NewState bool `json:"new-state"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.switchtransition.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.switchtransition.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +SwitchTransition represents the event body for the "SwitchTransition" event. +Since v4.0.0. +*/ +type SwitchTransition struct { + EventBasic + + // The name of the new active transition. + TransitionName string `json:"transition-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionbegin.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionbegin.go @@ -0,0 +1,27 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +TransitionBegin represents the event body for the "TransitionBegin" event. +Since v4.0.0. +*/ +type TransitionBegin struct { + EventBasic + + // Transition duration (in milliseconds). Will be -1 for any transition with a fixed duration, such as a Stinger, + // due to limitations of the OBS API. + Duration int `json:"duration,omitempty"` + + // Source scene of the transition + FromScene string `json:"from-scene,omitempty"` + + // Transition name. + Name string `json:"name,omitempty"` + + // Destination scene of the transition + ToScene string `json:"to-scene,omitempty"` + + // Transition type. + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitiondurationchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitiondurationchanged.go @@ -0,0 +1,14 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +TransitionDurationChanged represents the event body for the "TransitionDurationChanged" event. +Since v4.0.0. +*/ +type TransitionDurationChanged struct { + EventBasic + + // New transition duration. + NewDuration int `json:"new-duration,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionend.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionend.go @@ -0,0 +1,23 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +TransitionEnd represents the event body for the "TransitionEnd" event. +Since v4.8.0. +*/ +type TransitionEnd struct { + EventBasic + + // Transition duration (in milliseconds). + Duration int `json:"duration,omitempty"` + + // Transition name. + Name string `json:"name,omitempty"` + + // Destination scene of the transition + ToScene string `json:"to-scene,omitempty"` + + // Transition type. + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionlistchanged.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionlistchanged.go @@ -0,0 +1,18 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +TransitionListChanged represents the event body for the "TransitionListChanged" event. +Since v4.0.0. +*/ +type TransitionListChanged struct { + EventBasic + + Transitions []*Transition `json:"transitions,omitempty"` +} + +type Transition struct { + // Transition name. + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionvideoend.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.transitions.transitionvideoend.go @@ -0,0 +1,26 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +TransitionVideoEnd represents the event body for the "TransitionVideoEnd" event. +Since v4.8.0. +*/ +type TransitionVideoEnd struct { + EventBasic + + // Transition duration (in milliseconds). + Duration int `json:"duration,omitempty"` + + // Source scene of the transition + FromScene string `json:"from-scene,omitempty"` + + // Transition name. + Name string `json:"name,omitempty"` + + // Destination scene of the transition + ToScene string `json:"to-scene,omitempty"` + + // Transition type. + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstarted.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstarted.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +VirtualCamStarted represents the event body for the "VirtualCamStarted" event. +Since v4.9.1. +*/ +type VirtualCamStarted struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstopped.go b/vendor/github.com/andreykaipov/goobs/api/events/xx_generated.virtual_cam.virtualcamstopped.go @@ -0,0 +1,11 @@ +// This file has been automatically generated. Don't edit it. + +package events + +/* +VirtualCamStopped represents the event body for the "VirtualCamStopped" event. +Since v4.9.1. +*/ +type VirtualCamStopped struct { + EventBasic +} diff --git a/vendor/github.com/andreykaipov/goobs/api/events/zz_generated.events.go b/vendor/github.com/andreykaipov/goobs/api/events/zz_generated.events.go @@ -0,0 +1,136 @@ +// This file has been automatically generated. Don't edit it. + +package events + +func GetEventForType(name string) Event { + switch name { + case "Heartbeat": + return &Heartbeat{} + case "BroadcastCustomMessage": + return &BroadcastCustomMessage{} + case "MediaPlaying": + return &MediaPlaying{} + case "MediaPaused": + return &MediaPaused{} + case "MediaRestarted": + return &MediaRestarted{} + case "MediaStopped": + return &MediaStopped{} + case "MediaNext": + return &MediaNext{} + case "MediaPrevious": + return &MediaPrevious{} + case "MediaStarted": + return &MediaStarted{} + case "MediaEnded": + return &MediaEnded{} + case "Exiting": + return &Exiting{} + case "ProfileChanged": + return &ProfileChanged{} + case "ProfileListChanged": + return &ProfileListChanged{} + case "RecordingStarting": + return &RecordingStarting{} + case "RecordingStarted": + return &RecordingStarted{} + case "RecordingStopping": + return &RecordingStopping{} + case "RecordingStopped": + return &RecordingStopped{} + case "RecordingPaused": + return &RecordingPaused{} + case "RecordingResumed": + return &RecordingResumed{} + case "ReplayStarting": + return &ReplayStarting{} + case "ReplayStarted": + return &ReplayStarted{} + case "ReplayStopping": + return &ReplayStopping{} + case "ReplayStopped": + return &ReplayStopped{} + case "SourceOrderChanged": + return &SourceOrderChanged{} + case "SceneItemAdded": + return &SceneItemAdded{} + case "SceneItemRemoved": + return &SceneItemRemoved{} + case "SceneItemVisibilityChanged": + return &SceneItemVisibilityChanged{} + case "SceneItemLockChanged": + return &SceneItemLockChanged{} + case "SceneItemTransformChanged": + return &SceneItemTransformChanged{} + case "SceneItemSelected": + return &SceneItemSelected{} + case "SceneItemDeselected": + return &SceneItemDeselected{} + case "SwitchScenes": + return &SwitchScenes{} + case "ScenesChanged": + return &ScenesChanged{} + case "SceneCollectionChanged": + return &SceneCollectionChanged{} + case "SceneCollectionListChanged": + return &SceneCollectionListChanged{} + case "SourceCreated": + return &SourceCreated{} + case "SourceDestroyed": + return &SourceDestroyed{} + case "SourceVolumeChanged": + return &SourceVolumeChanged{} + case "SourceMuteStateChanged": + return &SourceMuteStateChanged{} + case "SourceAudioDeactivated": + return &SourceAudioDeactivated{} + case "SourceAudioActivated": + return &SourceAudioActivated{} + case "SourceAudioSyncOffsetChanged": + return &SourceAudioSyncOffsetChanged{} + case "SourceAudioMixersChanged": + return &SourceAudioMixersChanged{} + case "SourceRenamed": + return &SourceRenamed{} + case "SourceFilterAdded": + return &SourceFilterAdded{} + case "SourceFilterRemoved": + return &SourceFilterRemoved{} + case "SourceFilterVisibilityChanged": + return &SourceFilterVisibilityChanged{} + case "SourceFiltersReordered": + return &SourceFiltersReordered{} + case "StreamStarting": + return &StreamStarting{} + case "StreamStarted": + return &StreamStarted{} + case "StreamStopping": + return &StreamStopping{} + case "StreamStopped": + return &StreamStopped{} + case "StreamStatus": + return &StreamStatus{} + case "PreviewSceneChanged": + return &PreviewSceneChanged{} + case "StudioModeSwitched": + return &StudioModeSwitched{} + case "SwitchTransition": + return &SwitchTransition{} + case "TransitionListChanged": + return &TransitionListChanged{} + case "TransitionDurationChanged": + return &TransitionDurationChanged{} + case "TransitionBegin": + return &TransitionBegin{} + case "TransitionEnd": + return &TransitionEnd{} + case "TransitionVideoEnd": + return &TransitionVideoEnd{} + case "VirtualCamStarted": + return &VirtualCamStarted{} + case "VirtualCamStopped": + return &VirtualCamStopped{} + default: + return nil + } +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/client.go b/vendor/github.com/andreykaipov/goobs/api/requests/client.go @@ -0,0 +1,95 @@ +package requests + +import ( + "encoding/json" + "fmt" + + "github.com/gorilla/websocket" + uuid "github.com/nu7hatch/gouuid" +) + +// Client represents a client to an OBS websockets server, used for requests. +type Client struct { + // Conn is the backing websocket connection to the OBS websockets + // server. It's exported to pass the underlying connection to each + // category subclient. You shouldn't worry about this. + Conn *websocket.Conn + + IncomingResponses chan json.RawMessage +} + +/* +Disconnect sends a message to the OBS websockets server to close the client's +open connection. You don't really have to do this as any connections should +close when your program terminates or interrupts. But here's a function anyways. +*/ +func (c *Client) Disconnect() error { + return c.Conn.WriteMessage( + websocket.CloseMessage, + websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""), + ) +} + +// SendRequest abstracts the logic every subclient uses to send a request and +// receive the corresponding response. +// +// To get the response for a sent request, we can just read the next response +// from our channel. This works fine in a single-threaded context, and the +// message IDs of both the sent request and response should match. +// +// In a concurrent context, this isn't necessarily true, but since +// gorilla/websocket doesn't handle concurrency anyways, who cares? We could +// technically add a mutex in between sending our request and reading from the +// channel, but ehh... +// +// Interestingly, it does seem thread-safe if I use a totally different +// connection, in that connection A won't get a response from OBS for a request +// from connection B. So, message IDs must be unique per client? More +// interestingly, events appear to be broadcast to every client, maybe because +// they have no associated message ID? +func (c *Client) SendRequest(params Params, response Response) error { + params.SetRequestType(params.GetSelfName()) + + if params.GetRequestType() == "" { + return fmt.Errorf("Params %T has an empty RequestType", params) + } + + if params.GetMessageID() == "" { + id, err := uuid.NewV4() + if err != nil { + return err + } + + params.SetMessageID(id.String()) + } + + if err := c.Conn.WriteJSON(params); err != nil { + return err + } + + msg := <-c.IncomingResponses + if err := json.Unmarshal(msg, response); err != nil { + return fmt.Errorf("Couldn't unmarshal message into an unknown event: %s", err) + } + + // gorilla/websocket would panic before this could happen in + // a concurrent context, and idk how this could ever happen otherwise + if response.GetMessageID() != params.GetMessageID() { + return fmt.Errorf( + "Sent request %s, with message ID %s, but next response in channel has message ID %s", + params.GetSelfName(), + params.GetMessageID(), + response.GetMessageID(), + ) + } + + if response.GetStatus() == "error" { + return fmt.Errorf( + "Got error from OBS executing request %q: %s", + params.GetRequestType(), + response.GetError(), + ) + } + + return nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.authenticate.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.authenticate.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +AuthenticateParams represents the params body for the "Authenticate" request. +Attempt to authenticate the client to the server. +Since 0.3. +*/ +type AuthenticateParams struct { + requests.ParamsBasic + + // Response to the auth challenge (see "Authentication" for more information). + Auth string `json:"auth,omitempty"` +} + +// GetSelfName just returns "Authenticate". +func (o *AuthenticateParams) GetSelfName() string { + return "Authenticate" +} + +/* +AuthenticateResponse represents the response body for the "Authenticate" request. +Attempt to authenticate the client to the server. +Since v0.3. +*/ +type AuthenticateResponse struct { + requests.ResponseBasic +} + +// Authenticate sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) Authenticate(params *AuthenticateParams) (*AuthenticateResponse, error) { + data := &AuthenticateResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.broadcastcustommessage.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.broadcastcustommessage.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +BroadcastCustomMessageParams represents the params body for the "BroadcastCustomMessage" request. +Broadcast custom message to all connected WebSocket clients +Since 4.7.0. +*/ +type BroadcastCustomMessageParams struct { + requests.ParamsBasic + + // User-defined data + Data map[string]interface{} `json:"data,omitempty"` + + // Identifier to be choosen by the client + Realm string `json:"realm,omitempty"` +} + +// GetSelfName just returns "BroadcastCustomMessage". +func (o *BroadcastCustomMessageParams) GetSelfName() string { + return "BroadcastCustomMessage" +} + +/* +BroadcastCustomMessageResponse represents the response body for the "BroadcastCustomMessage" request. +Broadcast custom message to all connected WebSocket clients +Since v4.7.0. +*/ +type BroadcastCustomMessageResponse struct { + requests.ResponseBasic +} + +// BroadcastCustomMessage sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) BroadcastCustomMessage(params *BroadcastCustomMessageParams) (*BroadcastCustomMessageResponse, error) { + data := &BroadcastCustomMessageResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.executebatch.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.executebatch.go @@ -0,0 +1,64 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ExecuteBatchParams represents the params body for the "ExecuteBatch" request. +Executes a list of requests sequentially (one-by-one on the same thread). +Since 4.9.0. +*/ +type ExecuteBatchParams struct { + requests.ParamsBasic + + // Stop processing batch requests if one returns a failure. + AbortOnFail bool `json:"abortOnFail"` + + Requests []*Request `json:"requests,omitempty"` +} + +type Request struct { + // ID of the individual request. Can be any string and not required to be unique. Defaults to empty string if not + // specified. + MessageId string `json:"message-id,omitempty"` + + // Request type. Eg. `GetVersion`. + RequestType string `json:"request-type,omitempty"` +} + +// GetSelfName just returns "ExecuteBatch". +func (o *ExecuteBatchParams) GetSelfName() string { + return "ExecuteBatch" +} + +/* +ExecuteBatchResponse represents the response body for the "ExecuteBatch" request. +Executes a list of requests sequentially (one-by-one on the same thread). +Since v4.9.0. +*/ +type ExecuteBatchResponse struct { + requests.ResponseBasic + + Results []*Result `json:"results,omitempty"` +} + +type Result struct { + // Error message accompanying an `error` status. + Error string `json:"error,omitempty"` + + // ID of the individual request which was originally provided by the client. + MessageId string `json:"message-id,omitempty"` + + // Status response as string. Either `ok` or `error`. + Status string `json:"status,omitempty"` +} + +// ExecuteBatch sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ExecuteBatch(params *ExecuteBatchParams) (*ExecuteBatchResponse, error) { + data := &ExecuteBatchResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getauthrequired.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getauthrequired.go @@ -0,0 +1,51 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetAuthRequiredParams represents the params body for the "GetAuthRequired" request. +Tells the client if authentication is required. If so, returns authentication parameters `challenge` +and `salt` (see "Authentication" for more information). +Since 0.3. +*/ +type GetAuthRequiredParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetAuthRequired". +func (o *GetAuthRequiredParams) GetSelfName() string { + return "GetAuthRequired" +} + +/* +GetAuthRequiredResponse represents the response body for the "GetAuthRequired" request. +Tells the client if authentication is required. If so, returns authentication parameters `challenge` +and `salt` (see "Authentication" for more information). +Since v0.3. +*/ +type GetAuthRequiredResponse struct { + requests.ResponseBasic + + // Indicates whether authentication is required. + AuthRequired bool `json:"authRequired"` + + Challenge string `json:"challenge,omitempty"` + + Salt string `json:"salt,omitempty"` +} + +// GetAuthRequired sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetAuthRequired(paramss ...*GetAuthRequiredParams) (*GetAuthRequiredResponse, error) { + if len(paramss) == 0 { + paramss = []*GetAuthRequiredParams{{}} + } + params := paramss[0] + data := &GetAuthRequiredResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getfilenameformatting.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getfilenameformatting.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetFilenameFormattingParams represents the params body for the "GetFilenameFormatting" request. +Get the filename formatting string +Since 4.3.0. +*/ +type GetFilenameFormattingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetFilenameFormatting". +func (o *GetFilenameFormattingParams) GetSelfName() string { + return "GetFilenameFormatting" +} + +/* +GetFilenameFormattingResponse represents the response body for the "GetFilenameFormatting" request. +Get the filename formatting string +Since v4.3.0. +*/ +type GetFilenameFormattingResponse struct { + requests.ResponseBasic + + // Current filename formatting string. + FilenameFormatting string `json:"filename-formatting,omitempty"` +} + +// GetFilenameFormatting sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetFilenameFormatting( + paramss ...*GetFilenameFormattingParams, +) (*GetFilenameFormattingResponse, error) { + if len(paramss) == 0 { + paramss = []*GetFilenameFormattingParams{{}} + } + params := paramss[0] + data := &GetFilenameFormattingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getstats.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getstats.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetStatsParams represents the params body for the "GetStats" request. +Get OBS stats (almost the same info as provided in OBS' stats window) +Since 4.6.0. +*/ +type GetStatsParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetStats". +func (o *GetStatsParams) GetSelfName() string { + return "GetStats" +} + +/* +GetStatsResponse represents the response body for the "GetStats" request. +Get OBS stats (almost the same info as provided in OBS' stats window) +Since v4.6.0. +*/ +type GetStatsResponse struct { + requests.ResponseBasic + + // [OBS stats](#obsstats) + Stats typedefs.OBSStats `json:"stats,omitempty"` +} + +// GetStats sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as this +// request doesn't require any parameters. +func (c *Client) GetStats(paramss ...*GetStatsParams) (*GetStatsResponse, error) { + if len(paramss) == 0 { + paramss = []*GetStatsParams{{}} + } + params := paramss[0] + data := &GetStatsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getversion.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getversion.go @@ -0,0 +1,58 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetVersionParams represents the params body for the "GetVersion" request. +Returns the latest version of the plugin and the API. +Since 0.3. +*/ +type GetVersionParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetVersion". +func (o *GetVersionParams) GetSelfName() string { + return "GetVersion" +} + +/* +GetVersionResponse represents the response body for the "GetVersion" request. +Returns the latest version of the plugin and the API. +Since v0.3. +*/ +type GetVersionResponse struct { + requests.ResponseBasic + + // List of available request types, formatted as a comma-separated list string (e.g. : "Method1,Method2,Method3"). + AvailableRequests string `json:"available-requests,omitempty"` + + // OBS Studio program version. + ObsStudioVersion string `json:"obs-studio-version,omitempty"` + + // obs-websocket plugin version. + ObsWebsocketVersion string `json:"obs-websocket-version,omitempty"` + + // List of supported formats for features that use image export (like the TakeSourceScreenshot request type) + // formatted as a comma-separated list string + SupportedImageExportFormats string `json:"supported-image-export-formats,omitempty"` + + // OBSRemote compatible API version. Fixed to 1.1 for retrocompatibility. + Version float64 `json:"version,omitempty"` +} + +// GetVersion sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) GetVersion(paramss ...*GetVersionParams) (*GetVersionResponse, error) { + if len(paramss) == 0 { + paramss = []*GetVersionParams{{}} + } + params := paramss[0] + data := &GetVersionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getvideoinfo.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.getvideoinfo.go @@ -0,0 +1,69 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetVideoInfoParams represents the params body for the "GetVideoInfo" request. +Get basic OBS video information +Since 4.6.0. +*/ +type GetVideoInfoParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetVideoInfo". +func (o *GetVideoInfoParams) GetSelfName() string { + return "GetVideoInfo" +} + +/* +GetVideoInfoResponse represents the response body for the "GetVideoInfo" request. +Get basic OBS video information +Since v4.6.0. +*/ +type GetVideoInfoResponse struct { + requests.ResponseBasic + + // Base (canvas) height + BaseHeight int `json:"baseHeight,omitempty"` + + // Base (canvas) width + BaseWidth int `json:"baseWidth,omitempty"` + + // Color range (full or partial) + ColorRange string `json:"colorRange,omitempty"` + + // Color space for YUV + ColorSpace string `json:"colorSpace,omitempty"` + + // Frames rendered per second + Fps float64 `json:"fps,omitempty"` + + // Output height + OutputHeight int `json:"outputHeight,omitempty"` + + // Output width + OutputWidth int `json:"outputWidth,omitempty"` + + // Scaling method used if output size differs from base size + ScaleType string `json:"scaleType,omitempty"` + + // Video color format + VideoFormat string `json:"videoFormat,omitempty"` +} + +// GetVideoInfo sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) GetVideoInfo(paramss ...*GetVideoInfoParams) (*GetVideoInfoResponse, error) { + if len(paramss) == 0 { + paramss = []*GetVideoInfoParams{{}} + } + params := paramss[0] + data := &GetVideoInfoResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.openprojector.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.openprojector.go @@ -0,0 +1,50 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +OpenProjectorParams represents the params body for the "OpenProjector" request. +Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer. +Since 4.8.0. +*/ +type OpenProjectorParams struct { + requests.ParamsBasic + + // Size and position of the projector window (only if monitor is -1). Encoded in Base64 using [Qt's geometry + // encoding](https://doc.qt.io/qt-5/qwidget.html#saveGeometry). Corresponds to OBS's saved projectors. + Geometry string `json:"geometry,omitempty"` + + // Monitor to open the projector on. If -1 or omitted, opens a window. + Monitor int `json:"monitor,omitempty"` + + // Name of the source or scene to be displayed (ignored for other projector types). + Name string `json:"name,omitempty"` + + // Type of projector: `Preview` (default), `Source`, `Scene`, `StudioProgram`, or `Multiview` (case insensitive). + Type string `json:"type,omitempty"` +} + +// GetSelfName just returns "OpenProjector". +func (o *OpenProjectorParams) GetSelfName() string { + return "OpenProjector" +} + +/* +OpenProjectorResponse represents the response body for the "OpenProjector" request. +Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer. +Since v4.8.0. +*/ +type OpenProjectorResponse struct { + requests.ResponseBasic +} + +// OpenProjector sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) OpenProjector(params *OpenProjectorParams) (*OpenProjectorResponse, error) { + data := &OpenProjectorResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.setfilenameformatting.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.setfilenameformatting.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetFilenameFormattingParams represents the params body for the "SetFilenameFormatting" request. +Set the filename formatting string +Since 4.3.0. +*/ +type SetFilenameFormattingParams struct { + requests.ParamsBasic + + // Filename formatting string to set. + FilenameFormatting string `json:"filename-formatting,omitempty"` +} + +// GetSelfName just returns "SetFilenameFormatting". +func (o *SetFilenameFormattingParams) GetSelfName() string { + return "SetFilenameFormatting" +} + +/* +SetFilenameFormattingResponse represents the response body for the "SetFilenameFormatting" request. +Set the filename formatting string +Since v4.3.0. +*/ +type SetFilenameFormattingResponse struct { + requests.ResponseBasic +} + +// SetFilenameFormatting sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetFilenameFormatting(params *SetFilenameFormattingParams) (*SetFilenameFormattingResponse, error) { + data := &SetFilenameFormattingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.sleep.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.sleep.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SleepParams represents the params body for the "Sleep" request. +Waits for the specified duration. Designed to be used in `ExecuteBatch` operations. +Since 4.9.1. +*/ +type SleepParams struct { + requests.ParamsBasic + + // Delay in milliseconds to wait before continuing. + SleepMillis int `json:"sleepMillis,omitempty"` +} + +// GetSelfName just returns "Sleep". +func (o *SleepParams) GetSelfName() string { + return "Sleep" +} + +/* +SleepResponse represents the response body for the "Sleep" request. +Waits for the specified duration. Designed to be used in `ExecuteBatch` operations. +Since v4.9.1. +*/ +type SleepResponse struct { + requests.ResponseBasic +} + +// Sleep sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) Sleep(params *SleepParams) (*SleepResponse, error) { + data := &SleepResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybyname.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybyname.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +TriggerHotkeyByNameParams represents the params body for the "TriggerHotkeyByName" request. +Executes hotkey routine, identified by hotkey unique name +Since 4.9.0. +*/ +type TriggerHotkeyByNameParams struct { + requests.ParamsBasic + + // Unique name of the hotkey, as defined when registering the hotkey (e.g. "ReplayBuffer.Save") + HotkeyName string `json:"hotkeyName,omitempty"` +} + +// GetSelfName just returns "TriggerHotkeyByName". +func (o *TriggerHotkeyByNameParams) GetSelfName() string { + return "TriggerHotkeyByName" +} + +/* +TriggerHotkeyByNameResponse represents the response body for the "TriggerHotkeyByName" request. +Executes hotkey routine, identified by hotkey unique name +Since v4.9.0. +*/ +type TriggerHotkeyByNameResponse struct { + requests.ResponseBasic +} + +// TriggerHotkeyByName sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) TriggerHotkeyByName(params *TriggerHotkeyByNameParams) (*TriggerHotkeyByNameResponse, error) { + data := &TriggerHotkeyByNameResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybysequence.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/xx_generated.triggerhotkeybysequence.go @@ -0,0 +1,59 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +TriggerHotkeyBySequenceParams represents the params body for the "TriggerHotkeyBySequence" request. +Executes hotkey routine, identified by bound combination of keys. A single key combination might trigger multiple hotkey routines depending on user settings +Since 4.9.0. +*/ +type TriggerHotkeyBySequenceParams struct { + requests.ParamsBasic + + // Main key identifier (e.g. `OBS_KEY_A` for key "A"). Available identifiers + // [here](https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h) + KeyId string `json:"keyId,omitempty"` + + KeyModifiers *KeyModifiers `json:"keyModifiers,omitempty"` +} + +type KeyModifiers struct { + // Trigger Alt Key + Alt bool `json:"alt"` + + // Trigger Command Key (Mac) + Command bool `json:"command"` + + // Trigger Control (Ctrl) Key + Control bool `json:"control"` + + // Trigger Shift Key + Shift bool `json:"shift"` +} + +// GetSelfName just returns "TriggerHotkeyBySequence". +func (o *TriggerHotkeyBySequenceParams) GetSelfName() string { + return "TriggerHotkeyBySequence" +} + +/* +TriggerHotkeyBySequenceResponse represents the response body for the "TriggerHotkeyBySequence" request. +Executes hotkey routine, identified by bound combination of keys. A single key combination might trigger multiple hotkey routines depending on user settings +Since v4.9.0. +*/ +type TriggerHotkeyBySequenceResponse struct { + requests.ResponseBasic +} + +// TriggerHotkeyBySequence sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) TriggerHotkeyBySequence( + params *TriggerHotkeyBySequenceParams, +) (*TriggerHotkeyBySequenceResponse, error) { + data := &TriggerHotkeyBySequenceResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/general/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/general/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package general + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'general' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediaduration.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediaduration.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetMediaDurationParams represents the params body for the "GetMediaDuration" request. +Get the length of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note: For some reason, for the first 5 or so seconds that the media is playing, the total duration can be off by upwards of 50ms. +Since 4.9.0. +*/ +type GetMediaDurationParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetMediaDuration". +func (o *GetMediaDurationParams) GetSelfName() string { + return "GetMediaDuration" +} + +/* +GetMediaDurationResponse represents the response body for the "GetMediaDuration" request. +Get the length of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note: For some reason, for the first 5 or so seconds that the media is playing, the total duration can be off by upwards of 50ms. +Since v4.9.0. +*/ +type GetMediaDurationResponse struct { + requests.ResponseBasic + + // The total length of media in milliseconds.. + MediaDuration int `json:"mediaDuration,omitempty"` +} + +// GetMediaDuration sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetMediaDuration(params *GetMediaDurationParams) (*GetMediaDurationResponse, error) { + data := &GetMediaDurationResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediastate.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediastate.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetMediaStateParams represents the params body for the "GetMediaState" request. +Get the current playing state of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since 4.9.0. +*/ +type GetMediaStateParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetMediaState". +func (o *GetMediaStateParams) GetSelfName() string { + return "GetMediaState" +} + +/* +GetMediaStateResponse represents the response body for the "GetMediaState" request. +Get the current playing state of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since v4.9.0. +*/ +type GetMediaStateResponse struct { + requests.ResponseBasic + + // The media state of the provided source. States: `none`, `playing`, `opening`, `buffering`, `paused`, `stopped`, + // `ended`, `error`, `unknown` + MediaState string `json:"mediaState,omitempty"` +} + +// GetMediaState sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetMediaState(params *GetMediaStateParams) (*GetMediaStateResponse, error) { + data := &GetMediaStateResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediatime.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.getmediatime.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetMediaTimeParams represents the params body for the "GetMediaTime" request. +Get the current timestamp of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since 4.9.0. +*/ +type GetMediaTimeParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetMediaTime". +func (o *GetMediaTimeParams) GetSelfName() string { + return "GetMediaTime" +} + +/* +GetMediaTimeResponse represents the response body for the "GetMediaTime" request. +Get the current timestamp of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since v4.9.0. +*/ +type GetMediaTimeResponse struct { + requests.ResponseBasic + + // The time in milliseconds since the start of the media. + Timestamp int `json:"timestamp,omitempty"` +} + +// GetMediaTime sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetMediaTime(params *GetMediaTimeParams) (*GetMediaTimeResponse, error) { + data := &GetMediaTimeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.nextmedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.nextmedia.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +NextMediaParams represents the params body for the "NextMedia" request. +Skip to the next media item in the playlist. Supports only vlc media source (as of OBS v25.0.8) +Since 4.9.0. +*/ +type NextMediaParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "NextMedia". +func (o *NextMediaParams) GetSelfName() string { + return "NextMedia" +} + +/* +NextMediaResponse represents the response body for the "NextMedia" request. +Skip to the next media item in the playlist. Supports only vlc media source (as of OBS v25.0.8) +Since v4.9.0. +*/ +type NextMediaResponse struct { + requests.ResponseBasic +} + +// NextMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) NextMedia(params *NextMediaParams) (*NextMediaResponse, error) { + data := &NextMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.playpausemedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.playpausemedia.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +PlayPauseMediaParams represents the params body for the "PlayPauseMedia" request. +Pause or play a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note :Leaving out `playPause` toggles the current pause state +Since 4.9.0. +*/ +type PlayPauseMediaParams struct { + requests.ParamsBasic + + // (optional) Whether to pause or play the source. `false` for play, `true` for pause. + PlayPause bool `json:"playPause"` + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "PlayPauseMedia". +func (o *PlayPauseMediaParams) GetSelfName() string { + return "PlayPauseMedia" +} + +/* +PlayPauseMediaResponse represents the response body for the "PlayPauseMedia" request. +Pause or play a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note :Leaving out `playPause` toggles the current pause state +Since v4.9.0. +*/ +type PlayPauseMediaResponse struct { + requests.ResponseBasic +} + +// PlayPauseMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) PlayPauseMedia(params *PlayPauseMediaParams) (*PlayPauseMediaResponse, error) { + data := &PlayPauseMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.previousmedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.previousmedia.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +PreviousMediaParams represents the params body for the "PreviousMedia" request. +Go to the previous media item in the playlist. Supports only vlc media source (as of OBS v25.0.8) +Since 4.9.0. +*/ +type PreviousMediaParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "PreviousMedia". +func (o *PreviousMediaParams) GetSelfName() string { + return "PreviousMedia" +} + +/* +PreviousMediaResponse represents the response body for the "PreviousMedia" request. +Go to the previous media item in the playlist. Supports only vlc media source (as of OBS v25.0.8) +Since v4.9.0. +*/ +type PreviousMediaResponse struct { + requests.ResponseBasic +} + +// PreviousMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) PreviousMedia(params *PreviousMediaParams) (*PreviousMediaResponse, error) { + data := &PreviousMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.restartmedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.restartmedia.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +RestartMediaParams represents the params body for the "RestartMedia" request. +Restart a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since 4.9.0. +*/ +type RestartMediaParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "RestartMedia". +func (o *RestartMediaParams) GetSelfName() string { + return "RestartMedia" +} + +/* +RestartMediaResponse represents the response body for the "RestartMedia" request. +Restart a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since v4.9.0. +*/ +type RestartMediaResponse struct { + requests.ResponseBasic +} + +// RestartMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) RestartMedia(params *RestartMediaParams) (*RestartMediaResponse, error) { + data := &RestartMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.scrubmedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.scrubmedia.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ScrubMediaParams represents the params body for the "ScrubMedia" request. +Scrub media using a supplied offset. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note: Due to processing/network delays, this request is not perfect. The processing rate of this request has also not been tested. +Since 4.9.0. +*/ +type ScrubMediaParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Millisecond offset (positive or negative) to offset the current media position. + TimeOffset int `json:"timeOffset,omitempty"` +} + +// GetSelfName just returns "ScrubMedia". +func (o *ScrubMediaParams) GetSelfName() string { + return "ScrubMedia" +} + +/* +ScrubMediaResponse represents the response body for the "ScrubMedia" request. +Scrub media using a supplied offset. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Note: Due to processing/network delays, this request is not perfect. The processing rate of this request has also not been tested. +Since v4.9.0. +*/ +type ScrubMediaResponse struct { + requests.ResponseBasic +} + +// ScrubMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ScrubMedia(params *ScrubMediaParams) (*ScrubMediaResponse, error) { + data := &ScrubMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.setmediatime.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.setmediatime.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetMediaTimeParams represents the params body for the "SetMediaTime" request. +Set the timestamp of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since 4.9.0. +*/ +type SetMediaTimeParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Milliseconds to set the timestamp to. + Timestamp int `json:"timestamp,omitempty"` +} + +// GetSelfName just returns "SetMediaTime". +func (o *SetMediaTimeParams) GetSelfName() string { + return "SetMediaTime" +} + +/* +SetMediaTimeResponse represents the response body for the "SetMediaTime" request. +Set the timestamp of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since v4.9.0. +*/ +type SetMediaTimeResponse struct { + requests.ResponseBasic +} + +// SetMediaTime sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetMediaTime(params *SetMediaTimeParams) (*SetMediaTimeResponse, error) { + data := &SetMediaTimeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.stopmedia.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/xx_generated.stopmedia.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopMediaParams represents the params body for the "StopMedia" request. +Stop a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since 4.9.0. +*/ +type StopMediaParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "StopMedia". +func (o *StopMediaParams) GetSelfName() string { + return "StopMedia" +} + +/* +StopMediaResponse represents the response body for the "StopMedia" request. +Stop a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8) +Since v4.9.0. +*/ +type StopMediaResponse struct { + requests.ResponseBasic +} + +// StopMedia sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) StopMedia(params *StopMediaParams) (*StopMediaResponse, error) { + data := &StopMediaResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/media_control/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/media_control/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package mediacontrol + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'media control' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.getoutputinfo.go b/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.getoutputinfo.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package outputs + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetOutputInfoParams represents the params body for the "GetOutputInfo" request. +Get information about a single output +Since 4.7.0. +*/ +type GetOutputInfoParams struct { + requests.ParamsBasic + + // Output name + OutputName string `json:"outputName,omitempty"` +} + +// GetSelfName just returns "GetOutputInfo". +func (o *GetOutputInfoParams) GetSelfName() string { + return "GetOutputInfo" +} + +/* +GetOutputInfoResponse represents the response body for the "GetOutputInfo" request. +Get information about a single output +Since v4.7.0. +*/ +type GetOutputInfoResponse struct { + requests.ResponseBasic + + // Output info + OutputInfo typedefs.Output `json:"outputInfo,omitempty"` +} + +// GetOutputInfo sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetOutputInfo(params *GetOutputInfoParams) (*GetOutputInfoResponse, error) { + data := &GetOutputInfoResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.listoutputs.go b/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.listoutputs.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package outputs + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +ListOutputsParams represents the params body for the "ListOutputs" request. +List existing outputs +Since 4.7.0. +*/ +type ListOutputsParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ListOutputs". +func (o *ListOutputsParams) GetSelfName() string { + return "ListOutputs" +} + +/* +ListOutputsResponse represents the response body for the "ListOutputs" request. +List existing outputs +Since v4.7.0. +*/ +type ListOutputsResponse struct { + requests.ResponseBasic + + // Outputs list + Outputs []typedefs.Output `json:"outputs,omitempty"` +} + +// ListOutputs sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) ListOutputs(paramss ...*ListOutputsParams) (*ListOutputsResponse, error) { + if len(paramss) == 0 { + paramss = []*ListOutputsParams{{}} + } + params := paramss[0] + data := &ListOutputsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.startoutput.go b/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.startoutput.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package outputs + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartOutputParams represents the params body for the "StartOutput" request. +Start an output + +Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way. +Since 4.7.0. +*/ +type StartOutputParams struct { + requests.ParamsBasic + + // Output name + OutputName string `json:"outputName,omitempty"` +} + +// GetSelfName just returns "StartOutput". +func (o *StartOutputParams) GetSelfName() string { + return "StartOutput" +} + +/* +StartOutputResponse represents the response body for the "StartOutput" request. +Start an output + +Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way. +Since v4.7.0. +*/ +type StartOutputResponse struct { + requests.ResponseBasic +} + +// StartOutput sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) StartOutput(params *StartOutputParams) (*StartOutputResponse, error) { + data := &StartOutputResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.stopoutput.go b/vendor/github.com/andreykaipov/goobs/api/requests/outputs/xx_generated.stopoutput.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package outputs + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopOutputParams represents the params body for the "StopOutput" request. +Stop an output + +Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way. +Since 4.7.0. +*/ +type StopOutputParams struct { + requests.ParamsBasic + + // Force stop (default: false) + Force bool `json:"force"` + + // Output name + OutputName string `json:"outputName,omitempty"` +} + +// GetSelfName just returns "StopOutput". +func (o *StopOutputParams) GetSelfName() string { + return "StopOutput" +} + +/* +StopOutputResponse represents the response body for the "StopOutput" request. +Stop an output + +Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way. +Since v4.7.0. +*/ +type StopOutputResponse struct { + requests.ResponseBasic +} + +// StopOutput sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) StopOutput(params *StopOutputParams) (*StopOutputResponse, error) { + data := &StopOutputResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/outputs/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/outputs/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package outputs + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'outputs' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.getcurrentprofile.go b/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.getcurrentprofile.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package profiles + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetCurrentProfileParams represents the params body for the "GetCurrentProfile" request. +Get the name of the current profile. +Since 4.0.0. +*/ +type GetCurrentProfileParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetCurrentProfile". +func (o *GetCurrentProfileParams) GetSelfName() string { + return "GetCurrentProfile" +} + +/* +GetCurrentProfileResponse represents the response body for the "GetCurrentProfile" request. +Get the name of the current profile. +Since v4.0.0. +*/ +type GetCurrentProfileResponse struct { + requests.ResponseBasic + + // Name of the currently active profile. + ProfileName string `json:"profile-name,omitempty"` +} + +// GetCurrentProfile sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetCurrentProfile(paramss ...*GetCurrentProfileParams) (*GetCurrentProfileResponse, error) { + if len(paramss) == 0 { + paramss = []*GetCurrentProfileParams{{}} + } + params := paramss[0] + data := &GetCurrentProfileResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.listprofiles.go b/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.listprofiles.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package profiles + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ListProfilesParams represents the params body for the "ListProfiles" request. +Get a list of available profiles. +Since 4.0.0. +*/ +type ListProfilesParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ListProfiles". +func (o *ListProfilesParams) GetSelfName() string { + return "ListProfiles" +} + +/* +ListProfilesResponse represents the response body for the "ListProfiles" request. +Get a list of available profiles. +Since v4.0.0. +*/ +type ListProfilesResponse struct { + requests.ResponseBasic + + Profiles []*Profile `json:"profiles,omitempty"` +} + +type Profile struct { + // Filter name + ProfileName string `json:"profile-name,omitempty"` +} + +// ListProfiles sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) ListProfiles(paramss ...*ListProfilesParams) (*ListProfilesResponse, error) { + if len(paramss) == 0 { + paramss = []*ListProfilesParams{{}} + } + params := paramss[0] + data := &ListProfilesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.setcurrentprofile.go b/vendor/github.com/andreykaipov/goobs/api/requests/profiles/xx_generated.setcurrentprofile.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package profiles + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetCurrentProfileParams represents the params body for the "SetCurrentProfile" request. +Set the currently active profile. +Since 4.0.0. +*/ +type SetCurrentProfileParams struct { + requests.ParamsBasic + + // Name of the desired profile. + ProfileName string `json:"profile-name,omitempty"` +} + +// GetSelfName just returns "SetCurrentProfile". +func (o *SetCurrentProfileParams) GetSelfName() string { + return "SetCurrentProfile" +} + +/* +SetCurrentProfileResponse represents the response body for the "SetCurrentProfile" request. +Set the currently active profile. +Since v4.0.0. +*/ +type SetCurrentProfileResponse struct { + requests.ResponseBasic +} + +// SetCurrentProfile sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetCurrentProfile(params *SetCurrentProfileParams) (*SetCurrentProfileResponse, error) { + data := &SetCurrentProfileResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/profiles/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/profiles/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package profiles + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'profiles' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingfolder.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingfolder.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetRecordingFolderParams represents the params body for the "GetRecordingFolder" request. +Get the path of the current recording folder. +Since 4.1.0. +*/ +type GetRecordingFolderParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetRecordingFolder". +func (o *GetRecordingFolderParams) GetSelfName() string { + return "GetRecordingFolder" +} + +/* +GetRecordingFolderResponse represents the response body for the "GetRecordingFolder" request. +Get the path of the current recording folder. +Since v4.1.0. +*/ +type GetRecordingFolderResponse struct { + requests.ResponseBasic + + // Path of the recording folder. + RecFolder string `json:"rec-folder,omitempty"` +} + +// GetRecordingFolder sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetRecordingFolder(paramss ...*GetRecordingFolderParams) (*GetRecordingFolderResponse, error) { + if len(paramss) == 0 { + paramss = []*GetRecordingFolderParams{{}} + } + params := paramss[0] + data := &GetRecordingFolderResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingstatus.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.getrecordingstatus.go @@ -0,0 +1,54 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetRecordingStatusParams represents the params body for the "GetRecordingStatus" request. +Get current recording status. +Since 4.9.0. +*/ +type GetRecordingStatusParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetRecordingStatus". +func (o *GetRecordingStatusParams) GetSelfName() string { + return "GetRecordingStatus" +} + +/* +GetRecordingStatusResponse represents the response body for the "GetRecordingStatus" request. +Get current recording status. +Since v4.9.0. +*/ +type GetRecordingStatusResponse struct { + requests.ResponseBasic + + // Current recording status. + IsRecording bool `json:"isRecording"` + + // Whether the recording is paused or not. + IsRecordingPaused bool `json:"isRecordingPaused"` + + // Time elapsed since recording started (only present if currently recording). + RecordTimecode string `json:"recordTimecode,omitempty"` + + // Absolute path to the recording file (only present if currently recording). + RecordingFilename string `json:"recordingFilename,omitempty"` +} + +// GetRecordingStatus sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetRecordingStatus(paramss ...*GetRecordingStatusParams) (*GetRecordingStatusResponse, error) { + if len(paramss) == 0 { + paramss = []*GetRecordingStatusParams{{}} + } + params := paramss[0] + data := &GetRecordingStatusResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.pauserecording.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.pauserecording.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +PauseRecordingParams represents the params body for the "PauseRecording" request. +Pause the current recording. +Returns an error if recording is not active or already paused. +Since 4.7.0. +*/ +type PauseRecordingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "PauseRecording". +func (o *PauseRecordingParams) GetSelfName() string { + return "PauseRecording" +} + +/* +PauseRecordingResponse represents the response body for the "PauseRecording" request. +Pause the current recording. +Returns an error if recording is not active or already paused. +Since v4.7.0. +*/ +type PauseRecordingResponse struct { + requests.ResponseBasic +} + +// PauseRecording sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) PauseRecording(paramss ...*PauseRecordingParams) (*PauseRecordingResponse, error) { + if len(paramss) == 0 { + paramss = []*PauseRecordingParams{{}} + } + params := paramss[0] + data := &PauseRecordingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.resumerecording.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.resumerecording.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ResumeRecordingParams represents the params body for the "ResumeRecording" request. +Resume/unpause the current recording (if paused). +Returns an error if recording is not active or not paused. +Since 4.7.0. +*/ +type ResumeRecordingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ResumeRecording". +func (o *ResumeRecordingParams) GetSelfName() string { + return "ResumeRecording" +} + +/* +ResumeRecordingResponse represents the response body for the "ResumeRecording" request. +Resume/unpause the current recording (if paused). +Returns an error if recording is not active or not paused. +Since v4.7.0. +*/ +type ResumeRecordingResponse struct { + requests.ResponseBasic +} + +// ResumeRecording sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) ResumeRecording(paramss ...*ResumeRecordingParams) (*ResumeRecordingResponse, error) { + if len(paramss) == 0 { + paramss = []*ResumeRecordingParams{{}} + } + params := paramss[0] + data := &ResumeRecordingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.setrecordingfolder.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.setrecordingfolder.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetRecordingFolderParams represents the params body for the "SetRecordingFolder" request. +In the current profile, sets the recording folder of the Simple and Advanced output modes to the specified value. + +Note: If `SetRecordingFolder` is called while a recording is +in progress, the change won't be applied immediately and will be +effective on the next recording. +Since 4.1.0. +*/ +type SetRecordingFolderParams struct { + requests.ParamsBasic + + // Path of the recording folder. + RecFolder string `json:"rec-folder,omitempty"` +} + +// GetSelfName just returns "SetRecordingFolder". +func (o *SetRecordingFolderParams) GetSelfName() string { + return "SetRecordingFolder" +} + +/* +SetRecordingFolderResponse represents the response body for the "SetRecordingFolder" request. +In the current profile, sets the recording folder of the Simple and Advanced output modes to the specified value. + +Note: If `SetRecordingFolder` is called while a recording is +in progress, the change won't be applied immediately and will be +effective on the next recording. +Since v4.1.0. +*/ +type SetRecordingFolderResponse struct { + requests.ResponseBasic +} + +// SetRecordingFolder sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetRecordingFolder(params *SetRecordingFolderParams) (*SetRecordingFolderResponse, error) { + data := &SetRecordingFolderResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startrecording.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startrecording.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartRecordingParams represents the params body for the "StartRecording" request. +Start recording. +Will return an `error` if recording is already active. +Since 4.1.0. +*/ +type StartRecordingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartRecording". +func (o *StartRecordingParams) GetSelfName() string { + return "StartRecording" +} + +/* +StartRecordingResponse represents the response body for the "StartRecording" request. +Start recording. +Will return an `error` if recording is already active. +Since v4.1.0. +*/ +type StartRecordingResponse struct { + requests.ResponseBasic +} + +// StartRecording sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) StartRecording(paramss ...*StartRecordingParams) (*StartRecordingResponse, error) { + if len(paramss) == 0 { + paramss = []*StartRecordingParams{{}} + } + params := paramss[0] + data := &StartRecordingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startstoprecording.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.startstoprecording.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartStopRecordingParams represents the params body for the "StartStopRecording" request. +Toggle recording on or off (depending on the current recording state). +Since 0.3. +*/ +type StartStopRecordingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartStopRecording". +func (o *StartStopRecordingParams) GetSelfName() string { + return "StartStopRecording" +} + +/* +StartStopRecordingResponse represents the response body for the "StartStopRecording" request. +Toggle recording on or off (depending on the current recording state). +Since v0.3. +*/ +type StartStopRecordingResponse struct { + requests.ResponseBasic +} + +// StartStopRecording sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) StartStopRecording(paramss ...*StartStopRecordingParams) (*StartStopRecordingResponse, error) { + if len(paramss) == 0 { + paramss = []*StartStopRecordingParams{{}} + } + params := paramss[0] + data := &StartStopRecordingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.stoprecording.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/xx_generated.stoprecording.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopRecordingParams represents the params body for the "StopRecording" request. +Stop recording. +Will return an `error` if recording is not active. +Since 4.1.0. +*/ +type StopRecordingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StopRecording". +func (o *StopRecordingParams) GetSelfName() string { + return "StopRecording" +} + +/* +StopRecordingResponse represents the response body for the "StopRecording" request. +Stop recording. +Will return an `error` if recording is not active. +Since v4.1.0. +*/ +type StopRecordingResponse struct { + requests.ResponseBasic +} + +// StopRecording sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) StopRecording(paramss ...*StopRecordingParams) (*StopRecordingResponse, error) { + if len(paramss) == 0 { + paramss = []*StopRecordingParams{{}} + } + params := paramss[0] + data := &StopRecordingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/recording/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/recording/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package recording + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'recording' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.getreplaybufferstatus.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.getreplaybufferstatus.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetReplayBufferStatusParams represents the params body for the "GetReplayBufferStatus" request. +Get the status of the OBS replay buffer. +Since 4.9.0. +*/ +type GetReplayBufferStatusParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetReplayBufferStatus". +func (o *GetReplayBufferStatusParams) GetSelfName() string { + return "GetReplayBufferStatus" +} + +/* +GetReplayBufferStatusResponse represents the response body for the "GetReplayBufferStatus" request. +Get the status of the OBS replay buffer. +Since v4.9.0. +*/ +type GetReplayBufferStatusResponse struct { + requests.ResponseBasic + + // Current recording status. + IsReplayBufferActive bool `json:"isReplayBufferActive"` +} + +// GetReplayBufferStatus sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetReplayBufferStatus( + paramss ...*GetReplayBufferStatusParams, +) (*GetReplayBufferStatusResponse, error) { + if len(paramss) == 0 { + paramss = []*GetReplayBufferStatusParams{{}} + } + params := paramss[0] + data := &GetReplayBufferStatusResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.savereplaybuffer.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.savereplaybuffer.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SaveReplayBufferParams represents the params body for the "SaveReplayBuffer" request. +Flush and save the contents of the Replay Buffer to disk. This is +basically the same as triggering the "Save Replay Buffer" hotkey. +Will return an `error` if the Replay Buffer is not active. +Since 4.2.0. +*/ +type SaveReplayBufferParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "SaveReplayBuffer". +func (o *SaveReplayBufferParams) GetSelfName() string { + return "SaveReplayBuffer" +} + +/* +SaveReplayBufferResponse represents the response body for the "SaveReplayBuffer" request. +Flush and save the contents of the Replay Buffer to disk. This is +basically the same as triggering the "Save Replay Buffer" hotkey. +Will return an `error` if the Replay Buffer is not active. +Since v4.2.0. +*/ +type SaveReplayBufferResponse struct { + requests.ResponseBasic +} + +// SaveReplayBuffer sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) SaveReplayBuffer(paramss ...*SaveReplayBufferParams) (*SaveReplayBufferResponse, error) { + if len(paramss) == 0 { + paramss = []*SaveReplayBufferParams{{}} + } + params := paramss[0] + data := &SaveReplayBufferResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startreplaybuffer.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startreplaybuffer.go @@ -0,0 +1,50 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartReplayBufferParams represents the params body for the "StartReplayBuffer" request. +Start recording into the Replay Buffer. +Will return an `error` if the Replay Buffer is already active or if the +"Save Replay Buffer" hotkey is not set in OBS' settings. +Setting this hotkey is mandatory, even when triggering saves only +through obs-websocket. +Since 4.2.0. +*/ +type StartReplayBufferParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartReplayBuffer". +func (o *StartReplayBufferParams) GetSelfName() string { + return "StartReplayBuffer" +} + +/* +StartReplayBufferResponse represents the response body for the "StartReplayBuffer" request. +Start recording into the Replay Buffer. +Will return an `error` if the Replay Buffer is already active or if the +"Save Replay Buffer" hotkey is not set in OBS' settings. +Setting this hotkey is mandatory, even when triggering saves only +through obs-websocket. +Since v4.2.0. +*/ +type StartReplayBufferResponse struct { + requests.ResponseBasic +} + +// StartReplayBuffer sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) StartReplayBuffer(paramss ...*StartReplayBufferParams) (*StartReplayBufferResponse, error) { + if len(paramss) == 0 { + paramss = []*StartReplayBufferParams{{}} + } + params := paramss[0] + data := &StartReplayBufferResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startstopreplaybuffer.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.startstopreplaybuffer.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartStopReplayBufferParams represents the params body for the "StartStopReplayBuffer" request. +Toggle the Replay Buffer on/off (depending on the current state of the replay buffer). +Since 4.2.0. +*/ +type StartStopReplayBufferParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartStopReplayBuffer". +func (o *StartStopReplayBufferParams) GetSelfName() string { + return "StartStopReplayBuffer" +} + +/* +StartStopReplayBufferResponse represents the response body for the "StartStopReplayBuffer" request. +Toggle the Replay Buffer on/off (depending on the current state of the replay buffer). +Since v4.2.0. +*/ +type StartStopReplayBufferResponse struct { + requests.ResponseBasic +} + +// StartStopReplayBuffer sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) StartStopReplayBuffer( + paramss ...*StartStopReplayBufferParams, +) (*StartStopReplayBufferResponse, error) { + if len(paramss) == 0 { + paramss = []*StartStopReplayBufferParams{{}} + } + params := paramss[0] + data := &StartStopReplayBufferResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.stopreplaybuffer.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/xx_generated.stopreplaybuffer.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopReplayBufferParams represents the params body for the "StopReplayBuffer" request. +Stop recording into the Replay Buffer. +Will return an `error` if the Replay Buffer is not active. +Since 4.2.0. +*/ +type StopReplayBufferParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StopReplayBuffer". +func (o *StopReplayBufferParams) GetSelfName() string { + return "StopReplayBuffer" +} + +/* +StopReplayBufferResponse represents the response body for the "StopReplayBuffer" request. +Stop recording into the Replay Buffer. +Will return an `error` if the Replay Buffer is not active. +Since v4.2.0. +*/ +type StopReplayBufferResponse struct { + requests.ResponseBasic +} + +// StopReplayBuffer sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) StopReplayBuffer(paramss ...*StopReplayBufferParams) (*StopReplayBufferResponse, error) { + if len(paramss) == 0 { + paramss = []*StopReplayBufferParams{{}} + } + params := paramss[0] + data := &StopReplayBufferResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/replay_buffer/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package replaybuffer + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'replay buffer' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/requests.go b/vendor/github.com/andreykaipov/goobs/api/requests/requests.go @@ -0,0 +1,71 @@ +package requests + +// Params describes the behavior for any params-like object. Used to abstract +// the functionality of any request that embeds ParamsBasic within their fields. +type Params interface { + GetRequestType() string + SetRequestType(string) + GetMessageID() string + SetMessageID(string) + + // The name of the actual request, i.e. "Abc" for "AbcParams". Used to + // set the RequestType. + GetSelfName() string +} + +// ParamsBasic represents common parameters for any request. +type ParamsBasic struct { + RequestType string `json:"request-type,omitempty"` + MessageID string `json:"message-id,omitempty"` +} + +// GetRequestType does what it says. +func (o *ParamsBasic) GetRequestType() string { + return o.RequestType +} + +// SetRequestType does what it says. +func (o *ParamsBasic) SetRequestType(x string) { + o.RequestType = x +} + +// GetMessageID does what it says. +func (o *ParamsBasic) GetMessageID() string { + return o.MessageID +} + +// SetMessageID does what it says. +func (o *ParamsBasic) SetMessageID(x string) { + o.MessageID = x +} + +// Response describes the behavior for any response-like object. Used to +// abstract the functionality of any request's response that embeds +// ResponseBasic within their fields. +type Response interface { + GetMessageID() string + GetStatus() string + GetError() string +} + +// ResponseBasic represents common fields on any returned response. +type ResponseBasic struct { + MessageID string `json:"message-id,omitempty"` + Status string `json:"status,omitempty"` + Error string `json:"error,omitempty"` +} + +// GetMessageID does what it says. +func (o *ResponseBasic) GetMessageID() string { + return o.MessageID +} + +// GetStatus does what it says. +func (o *ResponseBasic) GetStatus() string { + return o.Status +} + +// GetError does what it says. +func (o *ResponseBasic) GetError() string { + return o.Error +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.getcurrentscenecollection.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.getcurrentscenecollection.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package scenecollections + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetCurrentSceneCollectionParams represents the params body for the "GetCurrentSceneCollection" request. +Get the name of the current scene collection. +Since 4.0.0. +*/ +type GetCurrentSceneCollectionParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetCurrentSceneCollection". +func (o *GetCurrentSceneCollectionParams) GetSelfName() string { + return "GetCurrentSceneCollection" +} + +/* +GetCurrentSceneCollectionResponse represents the response body for the "GetCurrentSceneCollection" request. +Get the name of the current scene collection. +Since v4.0.0. +*/ +type GetCurrentSceneCollectionResponse struct { + requests.ResponseBasic + + // Name of the currently active scene collection. + ScName string `json:"sc-name,omitempty"` +} + +// GetCurrentSceneCollection sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetCurrentSceneCollection( + paramss ...*GetCurrentSceneCollectionParams, +) (*GetCurrentSceneCollectionResponse, error) { + if len(paramss) == 0 { + paramss = []*GetCurrentSceneCollectionParams{{}} + } + params := paramss[0] + data := &GetCurrentSceneCollectionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.listscenecollections.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.listscenecollections.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package scenecollections + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +ListSceneCollectionsParams represents the params body for the "ListSceneCollections" request. +List available scene collections +Since 4.0.0. +*/ +type ListSceneCollectionsParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ListSceneCollections". +func (o *ListSceneCollectionsParams) GetSelfName() string { + return "ListSceneCollections" +} + +/* +ListSceneCollectionsResponse represents the response body for the "ListSceneCollections" request. +List available scene collections +Since v4.0.0. +*/ +type ListSceneCollectionsResponse struct { + requests.ResponseBasic + + // Scene collections list + SceneCollections []typedefs.ScenesCollection `json:"scene-collections,omitempty"` +} + +// ListSceneCollections sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) ListSceneCollections(paramss ...*ListSceneCollectionsParams) (*ListSceneCollectionsResponse, error) { + if len(paramss) == 0 { + paramss = []*ListSceneCollectionsParams{{}} + } + params := paramss[0] + data := &ListSceneCollectionsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.setcurrentscenecollection.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/xx_generated.setcurrentscenecollection.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package scenecollections + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetCurrentSceneCollectionParams represents the params body for the "SetCurrentSceneCollection" request. +Change the active scene collection. +Since 4.0.0. +*/ +type SetCurrentSceneCollectionParams struct { + requests.ParamsBasic + + // Name of the desired scene collection. + ScName string `json:"sc-name,omitempty"` +} + +// GetSelfName just returns "SetCurrentSceneCollection". +func (o *SetCurrentSceneCollectionParams) GetSelfName() string { + return "SetCurrentSceneCollection" +} + +/* +SetCurrentSceneCollectionResponse represents the response body for the "SetCurrentSceneCollection" request. +Change the active scene collection. +Since v4.0.0. +*/ +type SetCurrentSceneCollectionResponse struct { + requests.ResponseBasic +} + +// SetCurrentSceneCollection sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetCurrentSceneCollection( + params *SetCurrentSceneCollectionParams, +) (*SetCurrentSceneCollectionResponse, error) { + data := &SetCurrentSceneCollectionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_collections/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package scenecollections + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'scene collections' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.addsceneitem.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.addsceneitem.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +AddSceneItemParams represents the params body for the "AddSceneItem" request. +Creates a scene item in a scene. In other words, this is how you add a source into a scene. +Since 4.9.0. +*/ +type AddSceneItemParams struct { + requests.ParamsBasic + + // Name of the scene to create the scene item in + SceneName string `json:"sceneName,omitempty"` + + // Whether to make the sceneitem visible on creation or not. Default `true` + SetVisible bool `json:"setVisible"` + + // Name of the source to be added + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "AddSceneItem". +func (o *AddSceneItemParams) GetSelfName() string { + return "AddSceneItem" +} + +/* +AddSceneItemResponse represents the response body for the "AddSceneItem" request. +Creates a scene item in a scene. In other words, this is how you add a source into a scene. +Since v4.9.0. +*/ +type AddSceneItemResponse struct { + requests.ResponseBasic + + // Numerical ID of the created scene item + ItemId int `json:"itemId,omitempty"` +} + +// AddSceneItem sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) AddSceneItem(params *AddSceneItemParams) (*AddSceneItemResponse, error) { + data := &AddSceneItemResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.deletesceneitem.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.deletesceneitem.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +DeleteSceneItemParams represents the params body for the "DeleteSceneItem" request. +Deletes a scene item. +Since 4.5.0. +*/ +type DeleteSceneItemParams struct { + requests.ParamsBasic + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // Name of the scene the scene item belongs to. Defaults to the current scene. + Scene string `json:"scene,omitempty"` +} + +// GetSelfName just returns "DeleteSceneItem". +func (o *DeleteSceneItemParams) GetSelfName() string { + return "DeleteSceneItem" +} + +/* +DeleteSceneItemResponse represents the response body for the "DeleteSceneItem" request. +Deletes a scene item. +Since v4.5.0. +*/ +type DeleteSceneItemResponse struct { + requests.ResponseBasic +} + +// DeleteSceneItem sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) DeleteSceneItem(params *DeleteSceneItemParams) (*DeleteSceneItemResponse, error) { + data := &DeleteSceneItemResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.duplicatesceneitem.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.duplicatesceneitem.go @@ -0,0 +1,55 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +DuplicateSceneItemParams represents the params body for the "DuplicateSceneItem" request. +Duplicates a scene item. +Since 4.5.0. +*/ +type DuplicateSceneItemParams struct { + requests.ParamsBasic + + // Name of the scene to copy the item from. Defaults to the current scene. + FromScene string `json:"fromScene,omitempty"` + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // Name of the scene to create the item in. Defaults to the current scene. + ToScene string `json:"toScene,omitempty"` +} + +// GetSelfName just returns "DuplicateSceneItem". +func (o *DuplicateSceneItemParams) GetSelfName() string { + return "DuplicateSceneItem" +} + +/* +DuplicateSceneItemResponse represents the response body for the "DuplicateSceneItem" request. +Duplicates a scene item. +Since v4.5.0. +*/ +type DuplicateSceneItemResponse struct { + requests.ResponseBasic + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // Name of the scene where the new item was created + Scene string `json:"scene,omitempty"` +} + +// DuplicateSceneItem sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) DuplicateSceneItem(params *DuplicateSceneItemParams) (*DuplicateSceneItemResponse, error) { + data := &DuplicateSceneItemResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemlist.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemlist.go @@ -0,0 +1,59 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSceneItemListParams represents the params body for the "GetSceneItemList" request. +Get a list of all scene items in a scene. +Since 4.9.0. +*/ +type GetSceneItemListParams struct { + requests.ParamsBasic + + // Name of the scene to get the list of scene items from. Defaults to the current scene if not specified. + SceneName string `json:"sceneName,omitempty"` +} + +// GetSelfName just returns "GetSceneItemList". +func (o *GetSceneItemListParams) GetSelfName() string { + return "GetSceneItemList" +} + +/* +GetSceneItemListResponse represents the response body for the "GetSceneItemList" request. +Get a list of all scene items in a scene. +Since v4.9.0. +*/ +type GetSceneItemListResponse struct { + requests.ResponseBasic + + SceneItems []*SceneItem `json:"sceneItems,omitempty"` + + // Name of the requested (or current) scene + SceneName string `json:"sceneName,omitempty"` +} + +type SceneItem struct { + // Unique item id of the source item + ItemId int `json:"itemId,omitempty"` + + // ID if the scene item's source. For example `vlc_source` or `image_source` + SourceKind string `json:"sourceKind,omitempty"` + + // Name of the scene item's source + SourceName string `json:"sourceName,omitempty"` + + // Type of the scene item's source. Either `input`, `group`, or `scene` + SourceType string `json:"sourceType,omitempty"` +} + +// GetSceneItemList sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSceneItemList(params *GetSceneItemListParams) (*GetSceneItemListResponse, error) { + data := &GetSceneItemListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemproperties.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.getsceneitemproperties.go @@ -0,0 +1,96 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetSceneItemPropertiesParams represents the params body for the "GetSceneItemProperties" request. +Gets the scene specific properties of the specified source item. +Coordinates are relative to the item's parent (the scene or group it belongs to). +Since 4.3.0. +*/ +type GetSceneItemPropertiesParams struct { + requests.ParamsBasic + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // Name of the scene the scene item belongs to. Defaults to the current scene. + SceneName string `json:"scene-name,omitempty"` +} + +// GetSelfName just returns "GetSceneItemProperties". +func (o *GetSceneItemPropertiesParams) GetSelfName() string { + return "GetSceneItemProperties" +} + +/* +GetSceneItemPropertiesResponse represents the response body for the "GetSceneItemProperties" request. +Gets the scene specific properties of the specified source item. +Coordinates are relative to the item's parent (the scene or group it belongs to). +Since v4.3.0. +*/ +type GetSceneItemPropertiesResponse struct { + requests.ResponseBasic + + // The bounding box of the object (source, scene item, etc). + Bounds *typedefs.Bounds `json:"bounds,omitempty"` + + // The crop specification for the object (source, scene item, etc). + Crop *typedefs.Crop `json:"crop,omitempty"` + + // List of children (if this item is a group) + GroupChildren []typedefs.SceneItemTransform `json:"groupChildren,omitempty"` + + // Scene item height (base source height multiplied by the vertical scaling factor) + Height float64 `json:"height,omitempty"` + + // Scene Item ID. + ItemId int `json:"itemId,omitempty"` + + // If the source's transform is locked. + Locked bool `json:"locked"` + + // If the source is muted. + Muted bool `json:"muted"` + + // Scene Item name. + Name string `json:"name,omitempty"` + + // Name of the item's parent (if this item belongs to a group) + ParentGroupName string `json:"parentGroupName,omitempty"` + + // The position of the object (source, scene item, etc). + Position *typedefs.Position `json:"position,omitempty"` + + // The clockwise rotation of the item in degrees around the point of alignment. + Rotation float64 `json:"rotation,omitempty"` + + // The scaling specification for the object (source, scene item, etc). + Scale *typedefs.Scale `json:"scale,omitempty"` + + // Base source (without scaling) of the source + SourceHeight int `json:"sourceHeight,omitempty"` + + // Base width (without scaling) of the source + SourceWidth int `json:"sourceWidth,omitempty"` + + // If the source is visible. + Visible bool `json:"visible"` + + // Scene item width (base source width multiplied by the horizontal scaling factor) + Width float64 `json:"width,omitempty"` +} + +// GetSceneItemProperties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSceneItemProperties(params *GetSceneItemPropertiesParams) (*GetSceneItemPropertiesResponse, error) { + data := &GetSceneItemPropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.resetsceneitem.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.resetsceneitem.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +ResetSceneItemParams represents the params body for the "ResetSceneItem" request. +Reset a scene item. +Since 4.2.0. +*/ +type ResetSceneItemParams struct { + requests.ParamsBasic + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // Name of the scene the scene item belongs to. Defaults to the current scene. + SceneName string `json:"scene-name,omitempty"` +} + +// GetSelfName just returns "ResetSceneItem". +func (o *ResetSceneItemParams) GetSelfName() string { + return "ResetSceneItem" +} + +/* +ResetSceneItemResponse represents the response body for the "ResetSceneItem" request. +Reset a scene item. +Since v4.2.0. +*/ +type ResetSceneItemResponse struct { + requests.ResponseBasic +} + +// ResetSceneItem sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ResetSceneItem(params *ResetSceneItemParams) (*ResetSceneItemResponse, error) { + data := &ResetSceneItemResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemproperties.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemproperties.go @@ -0,0 +1,69 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +SetSceneItemPropertiesParams represents the params body for the "SetSceneItemProperties" request. +Sets the scene specific properties of a source. Unspecified properties will remain unchanged. +Coordinates are relative to the item's parent (the scene or group it belongs to). +Since 4.3.0. +*/ +type SetSceneItemPropertiesParams struct { + requests.ParamsBasic + + // The bounding box of the object (source, scene item, etc). + Bounds *typedefs.Bounds `json:"bounds,omitempty"` + + // The crop specification for the object (source, scene item, etc). + Crop *typedefs.Crop `json:"crop,omitempty"` + + // The item specification for this object. + Item *typedefs.Item `json:"item,omitempty"` + + // The new locked status of the source. 'true' keeps it in its current position, 'false' allows movement. + Locked bool `json:"locked"` + + // The position of the object (source, scene item, etc). + Position *typedefs.Position `json:"position,omitempty"` + + // The new clockwise rotation of the item in degrees. + Rotation float64 `json:"rotation,omitempty"` + + // The scaling specification for the object (source, scene item, etc). + Scale *typedefs.Scale `json:"scale,omitempty"` + + // Name of the scene the source item belongs to. Defaults to the current scene. + SceneName string `json:"scene-name,omitempty"` + + // The new visibility of the source. 'true' shows source, 'false' hides source. + Visible bool `json:"visible"` +} + +// GetSelfName just returns "SetSceneItemProperties". +func (o *SetSceneItemPropertiesParams) GetSelfName() string { + return "SetSceneItemProperties" +} + +/* +SetSceneItemPropertiesResponse represents the response body for the "SetSceneItemProperties" request. +Sets the scene specific properties of a source. Unspecified properties will remain unchanged. +Coordinates are relative to the item's parent (the scene or group it belongs to). +Since v4.3.0. +*/ +type SetSceneItemPropertiesResponse struct { + requests.ResponseBasic +} + +// SetSceneItemProperties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSceneItemProperties(params *SetSceneItemPropertiesParams) (*SetSceneItemPropertiesResponse, error) { + data := &SetSceneItemPropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemrender.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/xx_generated.setsceneitemrender.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSceneItemRenderParams represents the params body for the "SetSceneItemRender" request. +Show or hide a specified source item in a specified scene. +Since 0.3. +*/ +type SetSceneItemRenderParams struct { + requests.ParamsBasic + + // Scene Item id + Item int `json:"item,omitempty"` + + // true = shown ; false = hidden + Render bool `json:"render"` + + // Name of the scene the scene item belongs to. Defaults to the currently active scene. + SceneName string `json:"scene-name,omitempty"` + + // Scene Item name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "SetSceneItemRender". +func (o *SetSceneItemRenderParams) GetSelfName() string { + return "SetSceneItemRender" +} + +/* +SetSceneItemRenderResponse represents the response body for the "SetSceneItemRender" request. +Show or hide a specified source item in a specified scene. +Since v0.3. +*/ +type SetSceneItemRenderResponse struct { + requests.ResponseBasic +} + +// SetSceneItemRender sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSceneItemRender(params *SetSceneItemRenderParams) (*SetSceneItemRenderResponse, error) { + data := &SetSceneItemRenderResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/scene_items/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package sceneitems + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'scene items' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.createscene.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.createscene.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +CreateSceneParams represents the params body for the "CreateScene" request. +Create a new scene scene. +Since 4.9.0. +*/ +type CreateSceneParams struct { + requests.ParamsBasic + + // Name of the scene to create. + SceneName string `json:"sceneName,omitempty"` +} + +// GetSelfName just returns "CreateScene". +func (o *CreateSceneParams) GetSelfName() string { + return "CreateScene" +} + +/* +CreateSceneResponse represents the response body for the "CreateScene" request. +Create a new scene scene. +Since v4.9.0. +*/ +type CreateSceneResponse struct { + requests.ResponseBasic +} + +// CreateScene sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) CreateScene(params *CreateSceneParams) (*CreateSceneResponse, error) { + data := &CreateSceneResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getcurrentscene.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getcurrentscene.go @@ -0,0 +1,51 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetCurrentSceneParams represents the params body for the "GetCurrentScene" request. +Get the current scene's name and source items. +Since 0.3. +*/ +type GetCurrentSceneParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetCurrentScene". +func (o *GetCurrentSceneParams) GetSelfName() string { + return "GetCurrentScene" +} + +/* +GetCurrentSceneResponse represents the response body for the "GetCurrentScene" request. +Get the current scene's name and source items. +Since v0.3. +*/ +type GetCurrentSceneResponse struct { + requests.ResponseBasic + + // Name of the currently active scene. + Name string `json:"name,omitempty"` + + // Ordered list of the current scene's source items. + Sources []typedefs.SceneItem `json:"sources,omitempty"` +} + +// GetCurrentScene sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetCurrentScene(paramss ...*GetCurrentSceneParams) (*GetCurrentSceneResponse, error) { + if len(paramss) == 0 { + paramss = []*GetCurrentSceneParams{{}} + } + params := paramss[0] + data := &GetCurrentSceneResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenelist.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenelist.go @@ -0,0 +1,51 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetSceneListParams represents the params body for the "GetSceneList" request. +Get a list of scenes in the currently active profile. +Since 0.3. +*/ +type GetSceneListParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetSceneList". +func (o *GetSceneListParams) GetSelfName() string { + return "GetSceneList" +} + +/* +GetSceneListResponse represents the response body for the "GetSceneList" request. +Get a list of scenes in the currently active profile. +Since v0.3. +*/ +type GetSceneListResponse struct { + requests.ResponseBasic + + // Name of the currently active scene. + CurrentScene string `json:"current-scene,omitempty"` + + // Ordered list of the current profile's scenes (See [GetCurrentScene](#getcurrentscene) for more information). + Scenes []typedefs.Scene `json:"scenes,omitempty"` +} + +// GetSceneList sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) GetSceneList(paramss ...*GetSceneListParams) (*GetSceneListResponse, error) { + if len(paramss) == 0 { + paramss = []*GetSceneListParams{{}} + } + params := paramss[0] + data := &GetSceneListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenetransitionoverride.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.getscenetransitionoverride.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSceneTransitionOverrideParams represents the params body for the "GetSceneTransitionOverride" request. +Get the current scene transition override. +Since 4.8.0. +*/ +type GetSceneTransitionOverrideParams struct { + requests.ParamsBasic + + // Name of the scene to switch to. + SceneName string `json:"sceneName,omitempty"` +} + +// GetSelfName just returns "GetSceneTransitionOverride". +func (o *GetSceneTransitionOverrideParams) GetSelfName() string { + return "GetSceneTransitionOverride" +} + +/* +GetSceneTransitionOverrideResponse represents the response body for the "GetSceneTransitionOverride" request. +Get the current scene transition override. +Since v4.8.0. +*/ +type GetSceneTransitionOverrideResponse struct { + requests.ResponseBasic + + // Transition duration. `-1` if no override is set. + TransitionDuration int `json:"transitionDuration,omitempty"` + + // Name of the current overriding transition. Empty string if no override is set. + TransitionName string `json:"transitionName,omitempty"` +} + +// GetSceneTransitionOverride sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSceneTransitionOverride( + params *GetSceneTransitionOverrideParams, +) (*GetSceneTransitionOverrideResponse, error) { + data := &GetSceneTransitionOverrideResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.removescenetransitionoverride.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.removescenetransitionoverride.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +RemoveSceneTransitionOverrideParams represents the params body for the "RemoveSceneTransitionOverride" request. +Remove any transition override on a scene. +Since 4.8.0. +*/ +type RemoveSceneTransitionOverrideParams struct { + requests.ParamsBasic + + // Name of the scene to switch to. + SceneName string `json:"sceneName,omitempty"` +} + +// GetSelfName just returns "RemoveSceneTransitionOverride". +func (o *RemoveSceneTransitionOverrideParams) GetSelfName() string { + return "RemoveSceneTransitionOverride" +} + +/* +RemoveSceneTransitionOverrideResponse represents the response body for the "RemoveSceneTransitionOverride" request. +Remove any transition override on a scene. +Since v4.8.0. +*/ +type RemoveSceneTransitionOverrideResponse struct { + requests.ResponseBasic +} + +// RemoveSceneTransitionOverride sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) RemoveSceneTransitionOverride( + params *RemoveSceneTransitionOverrideParams, +) (*RemoveSceneTransitionOverrideResponse, error) { + data := &RemoveSceneTransitionOverrideResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.reordersceneitems.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.reordersceneitems.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +ReorderSceneItemsParams represents the params body for the "ReorderSceneItems" request. +Changes the order of scene items in the requested scene. +Since 4.5.0. +*/ +type ReorderSceneItemsParams struct { + requests.ParamsBasic + + // The items for this object. + Items []*typedefs.Item `json:"items,omitempty"` + + // Name of the scene to reorder (defaults to current). + Scene string `json:"scene,omitempty"` +} + +// GetSelfName just returns "ReorderSceneItems". +func (o *ReorderSceneItemsParams) GetSelfName() string { + return "ReorderSceneItems" +} + +/* +ReorderSceneItemsResponse represents the response body for the "ReorderSceneItems" request. +Changes the order of scene items in the requested scene. +Since v4.5.0. +*/ +type ReorderSceneItemsResponse struct { + requests.ResponseBasic +} + +// ReorderSceneItems sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ReorderSceneItems(params *ReorderSceneItemsParams) (*ReorderSceneItemsResponse, error) { + data := &ReorderSceneItemsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setcurrentscene.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setcurrentscene.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetCurrentSceneParams represents the params body for the "SetCurrentScene" request. +Switch to the specified scene. +Since 0.3. +*/ +type SetCurrentSceneParams struct { + requests.ParamsBasic + + // Name of the scene to switch to. + SceneName string `json:"scene-name,omitempty"` +} + +// GetSelfName just returns "SetCurrentScene". +func (o *SetCurrentSceneParams) GetSelfName() string { + return "SetCurrentScene" +} + +/* +SetCurrentSceneResponse represents the response body for the "SetCurrentScene" request. +Switch to the specified scene. +Since v0.3. +*/ +type SetCurrentSceneResponse struct { + requests.ResponseBasic +} + +// SetCurrentScene sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetCurrentScene(params *SetCurrentSceneParams) (*SetCurrentSceneResponse, error) { + data := &SetCurrentSceneResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setscenetransitionoverride.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/xx_generated.setscenetransitionoverride.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSceneTransitionOverrideParams represents the params body for the "SetSceneTransitionOverride" request. +Set a scene to use a specific transition override. +Since 4.8.0. +*/ +type SetSceneTransitionOverrideParams struct { + requests.ParamsBasic + + // Name of the scene to switch to. + SceneName string `json:"sceneName,omitempty"` + + // Duration in milliseconds of the transition if transition is not fixed. Defaults to the current duration specified + // in the UI if there is no current override and this value is not given. + TransitionDuration int `json:"transitionDuration,omitempty"` + + // Name of the transition to use. + TransitionName string `json:"transitionName,omitempty"` +} + +// GetSelfName just returns "SetSceneTransitionOverride". +func (o *SetSceneTransitionOverrideParams) GetSelfName() string { + return "SetSceneTransitionOverride" +} + +/* +SetSceneTransitionOverrideResponse represents the response body for the "SetSceneTransitionOverride" request. +Set a scene to use a specific transition override. +Since v4.8.0. +*/ +type SetSceneTransitionOverrideResponse struct { + requests.ResponseBasic +} + +// SetSceneTransitionOverride sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSceneTransitionOverride( + params *SetSceneTransitionOverrideParams, +) (*SetSceneTransitionOverrideResponse, error) { + data := &SetSceneTransitionOverrideResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/scenes/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/scenes/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package scenes + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'scenes' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.addfiltertosource.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.addfiltertosource.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +AddFilterToSourceParams represents the params body for the "AddFilterToSource" request. +Add a new filter to a source. Available source types along with their settings properties are available from `GetSourceTypesList`. +Since 4.5.0. +*/ +type AddFilterToSourceParams struct { + requests.ParamsBasic + + // Name of the new filter + FilterName string `json:"filterName,omitempty"` + + // Filter settings + FilterSettings map[string]interface{} `json:"filterSettings,omitempty"` + + // Filter type + FilterType string `json:"filterType,omitempty"` + + // Name of the source on which the filter is added + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "AddFilterToSource". +func (o *AddFilterToSourceParams) GetSelfName() string { + return "AddFilterToSource" +} + +/* +AddFilterToSourceResponse represents the response body for the "AddFilterToSource" request. +Add a new filter to a source. Available source types along with their settings properties are available from `GetSourceTypesList`. +Since v4.5.0. +*/ +type AddFilterToSourceResponse struct { + requests.ResponseBasic +} + +// AddFilterToSource sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) AddFilterToSource(params *AddFilterToSourceParams) (*AddFilterToSourceResponse, error) { + data := &AddFilterToSourceResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.createsource.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.createsource.go @@ -0,0 +1,55 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +CreateSourceParams represents the params body for the "CreateSource" request. +Create a source and add it as a sceneitem to a scene. +Since 4.9.0. +*/ +type CreateSourceParams struct { + requests.ParamsBasic + + // Scene to add the new source to. + SceneName string `json:"sceneName,omitempty"` + + // Set the created SceneItem as visible or not. Defaults to true + SetVisible bool `json:"setVisible"` + + // Source kind, Eg. `vlc_source`. + SourceKind string `json:"sourceKind,omitempty"` + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Source settings data. + SourceSettings map[string]interface{} `json:"sourceSettings,omitempty"` +} + +// GetSelfName just returns "CreateSource". +func (o *CreateSourceParams) GetSelfName() string { + return "CreateSource" +} + +/* +CreateSourceResponse represents the response body for the "CreateSource" request. +Create a source and add it as a sceneitem to a scene. +Since v4.9.0. +*/ +type CreateSourceResponse struct { + requests.ResponseBasic + + // ID of the SceneItem in the scene. + ItemId int `json:"itemId,omitempty"` +} + +// CreateSource sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) CreateSource(params *CreateSourceParams) (*CreateSourceResponse, error) { + data := &CreateSourceResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudioactive.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudioactive.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetAudioActiveParams represents the params body for the "GetAudioActive" request. +Get the audio's active status of a specified source. +Since 4.9.0. +*/ +type GetAudioActiveParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetAudioActive". +func (o *GetAudioActiveParams) GetSelfName() string { + return "GetAudioActive" +} + +/* +GetAudioActiveResponse represents the response body for the "GetAudioActive" request. +Get the audio's active status of a specified source. +Since v4.9.0. +*/ +type GetAudioActiveResponse struct { + requests.ResponseBasic + + // Audio active status of the source. + AudioActive bool `json:"audioActive"` +} + +// GetAudioActive sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetAudioActive(params *GetAudioActiveParams) (*GetAudioActiveResponse, error) { + data := &GetAudioActiveResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudiomonitortype.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getaudiomonitortype.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetAudioMonitorTypeParams represents the params body for the "GetAudioMonitorType" request. +Get the audio monitoring type of the specified source. +Since 4.8.0. +*/ +type GetAudioMonitorTypeParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetAudioMonitorType". +func (o *GetAudioMonitorTypeParams) GetSelfName() string { + return "GetAudioMonitorType" +} + +/* +GetAudioMonitorTypeResponse represents the response body for the "GetAudioMonitorType" request. +Get the audio monitoring type of the specified source. +Since v4.8.0. +*/ +type GetAudioMonitorTypeResponse struct { + requests.ResponseBasic + + // The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`. + MonitorType string `json:"monitorType,omitempty"` +} + +// GetAudioMonitorType sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetAudioMonitorType(params *GetAudioMonitorTypeParams) (*GetAudioMonitorTypeResponse, error) { + data := &GetAudioMonitorTypeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmediasourceslist.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmediasourceslist.go @@ -0,0 +1,56 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetMediaSourcesListParams represents the params body for the "GetMediaSourcesList" request. +List the media state of all media sources (vlc and media source) +Since 4.9.0. +*/ +type GetMediaSourcesListParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetMediaSourcesList". +func (o *GetMediaSourcesListParams) GetSelfName() string { + return "GetMediaSourcesList" +} + +/* +GetMediaSourcesListResponse represents the response body for the "GetMediaSourcesList" request. +List the media state of all media sources (vlc and media source) +Since v4.9.0. +*/ +type GetMediaSourcesListResponse struct { + requests.ResponseBasic + + MediaSources []*MediaSource `json:"mediaSources,omitempty"` +} + +type MediaSource struct { + // The current state of media for that source. States: `none`, `playing`, `opening`, `buffering`, `paused`, + // `stopped`, `ended`, `error`, `unknown` + MediaState string `json:"mediaState,omitempty"` + + // Unique source internal type (a.k.a `ffmpeg_source` or `vlc_source`) + SourceKind string `json:"sourceKind,omitempty"` + + // Unique source name + SourceName string `json:"sourceName,omitempty"` +} + +// GetMediaSourcesList sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetMediaSourcesList(paramss ...*GetMediaSourcesListParams) (*GetMediaSourcesListResponse, error) { + if len(paramss) == 0 { + paramss = []*GetMediaSourcesListParams{{}} + } + params := paramss[0] + data := &GetMediaSourcesListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmute.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getmute.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetMuteParams represents the params body for the "GetMute" request. +Get the mute status of a specified source. +Since 4.0.0. +*/ +type GetMuteParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "GetMute". +func (o *GetMuteParams) GetSelfName() string { + return "GetMute" +} + +/* +GetMuteResponse represents the response body for the "GetMute" request. +Get the mute status of a specified source. +Since v4.0.0. +*/ +type GetMuteResponse struct { + requests.ResponseBasic + + // Mute status of the source. + Muted bool `json:"muted"` + + // Source name. + Name string `json:"name,omitempty"` +} + +// GetMute sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetMute(params *GetMuteParams) (*GetMuteResponse, error) { + data := &GetMuteResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceactive.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceactive.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourceActiveParams represents the params body for the "GetSourceActive" request. +Get the source's active status of a specified source (if it is showing in the final mix). +Since 4.9.1. +*/ +type GetSourceActiveParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetSourceActive". +func (o *GetSourceActiveParams) GetSelfName() string { + return "GetSourceActive" +} + +/* +GetSourceActiveResponse represents the response body for the "GetSourceActive" request. +Get the source's active status of a specified source (if it is showing in the final mix). +Since v4.9.1. +*/ +type GetSourceActiveResponse struct { + requests.ResponseBasic + + // Source active status of the source. + SourceActive bool `json:"sourceActive"` +} + +// GetSourceActive sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSourceActive(params *GetSourceActiveParams) (*GetSourceActiveResponse, error) { + data := &GetSourceActiveResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcedefaultsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcedefaultsettings.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourceDefaultSettingsParams represents the params body for the "GetSourceDefaultSettings" request. +Get the default settings for a given source type. +Since 4.9.0. +*/ +type GetSourceDefaultSettingsParams struct { + requests.ParamsBasic + + // Source kind. Also called "source id" in libobs terminology. + SourceKind string `json:"sourceKind,omitempty"` +} + +// GetSelfName just returns "GetSourceDefaultSettings". +func (o *GetSourceDefaultSettingsParams) GetSelfName() string { + return "GetSourceDefaultSettings" +} + +/* +GetSourceDefaultSettingsResponse represents the response body for the "GetSourceDefaultSettings" request. +Get the default settings for a given source type. +Since v4.9.0. +*/ +type GetSourceDefaultSettingsResponse struct { + requests.ResponseBasic + + // Settings object for source. + DefaultSettings map[string]interface{} `json:"defaultSettings,omitempty"` + + // Source kind. Same value as the `sourceKind` parameter. + SourceKind string `json:"sourceKind,omitempty"` +} + +// GetSourceDefaultSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSourceDefaultSettings( + params *GetSourceDefaultSettingsParams, +) (*GetSourceDefaultSettingsResponse, error) { + data := &GetSourceDefaultSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilterinfo.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilterinfo.go @@ -0,0 +1,55 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourceFilterInfoParams represents the params body for the "GetSourceFilterInfo" request. +List filters applied to a source +Since 4.7.0. +*/ +type GetSourceFilterInfoParams struct { + requests.ParamsBasic + + // Source filter name + FilterName string `json:"filterName,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetSourceFilterInfo". +func (o *GetSourceFilterInfoParams) GetSelfName() string { + return "GetSourceFilterInfo" +} + +/* +GetSourceFilterInfoResponse represents the response body for the "GetSourceFilterInfo" request. +List filters applied to a source +Since v4.7.0. +*/ +type GetSourceFilterInfoResponse struct { + requests.ResponseBasic + + // Filter status (enabled or not) + Enabled bool `json:"enabled"` + + // Filter name + Name string `json:"name,omitempty"` + + // Filter settings + Settings map[string]interface{} `json:"settings,omitempty"` + + // Filter type + Type string `json:"type,omitempty"` +} + +// GetSourceFilterInfo sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSourceFilterInfo(params *GetSourceFilterInfoParams) (*GetSourceFilterInfoResponse, error) { + data := &GetSourceFilterInfoResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilters.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcefilters.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetSourceFiltersParams represents the params body for the "GetSourceFilters" request. +List filters applied to a source +Since 4.5.0. +*/ +type GetSourceFiltersParams struct { + requests.ParamsBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetSourceFilters". +func (o *GetSourceFiltersParams) GetSelfName() string { + return "GetSourceFilters" +} + +/* +GetSourceFiltersResponse represents the response body for the "GetSourceFilters" request. +List filters applied to a source +Since v4.5.0. +*/ +type GetSourceFiltersResponse struct { + requests.ResponseBasic + + // The filters for this object. + Filters []*typedefs.Filter `json:"filters,omitempty"` +} + +// GetSourceFilters sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSourceFilters(params *GetSourceFiltersParams) (*GetSourceFiltersResponse, error) { + data := &GetSourceFiltersResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcesettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcesettings.go @@ -0,0 +1,52 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourceSettingsParams represents the params body for the "GetSourceSettings" request. +Get settings of the specified source +Since 4.3.0. +*/ +type GetSourceSettingsParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Type of the specified source. Useful for type-checking if you expect a specific settings schema. + SourceType string `json:"sourceType,omitempty"` +} + +// GetSelfName just returns "GetSourceSettings". +func (o *GetSourceSettingsParams) GetSelfName() string { + return "GetSourceSettings" +} + +/* +GetSourceSettingsResponse represents the response body for the "GetSourceSettings" request. +Get settings of the specified source +Since v4.3.0. +*/ +type GetSourceSettingsResponse struct { + requests.ResponseBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Source settings (varies between source types, may require some probing around). + SourceSettings map[string]interface{} `json:"sourceSettings,omitempty"` + + // Type of the specified source + SourceType string `json:"sourceType,omitempty"` +} + +// GetSourceSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSourceSettings(params *GetSourceSettingsParams) (*GetSourceSettingsResponse, error) { + data := &GetSourceSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceslist.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourceslist.go @@ -0,0 +1,55 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourcesListParams represents the params body for the "GetSourcesList" request. +List all sources available in the running OBS instance +Since 4.3.0. +*/ +type GetSourcesListParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetSourcesList". +func (o *GetSourcesListParams) GetSelfName() string { + return "GetSourcesList" +} + +/* +GetSourcesListResponse represents the response body for the "GetSourcesList" request. +List all sources available in the running OBS instance +Since v4.3.0. +*/ +type GetSourcesListResponse struct { + requests.ResponseBasic + + Sources []*Source `json:"sources,omitempty"` +} + +type Source struct { + // Unique source name + Name string `json:"name,omitempty"` + + // Source type. Value is one of the following: "input", "filter", "transition", "scene" or "unknown" + Type string `json:"type,omitempty"` + + // Non-unique source internal type (a.k.a kind) + TypeId string `json:"typeId,omitempty"` +} + +// GetSourcesList sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) GetSourcesList(paramss ...*GetSourcesListParams) (*GetSourcesListResponse, error) { + if len(paramss) == 0 { + paramss = []*GetSourcesListParams{{}} + } + params := paramss[0] + data := &GetSourcesListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcetypeslist.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsourcetypeslist.go @@ -0,0 +1,83 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSourceTypesListParams represents the params body for the "GetSourceTypesList" request. +Get a list of all available sources types +Since 4.3.0. +*/ +type GetSourceTypesListParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetSourceTypesList". +func (o *GetSourceTypesListParams) GetSelfName() string { + return "GetSourceTypesList" +} + +/* +GetSourceTypesListResponse represents the response body for the "GetSourceTypesList" request. +Get a list of all available sources types +Since v4.3.0. +*/ +type GetSourceTypesListResponse struct { + requests.ResponseBasic + + Types []*Type `json:"types,omitempty"` +} + +type Caps struct { + // True if interaction with this sources of this type is possible + CanInteract bool `json:"canInteract"` + + // True if sources of this type should not be fully duplicated + DoNotDuplicate bool `json:"doNotDuplicate"` + + // True if sources of this type may cause a feedback loop if it's audio is monitored and shouldn't be + DoNotSelfMonitor bool `json:"doNotSelfMonitor"` + + // True if sources of this type provide audio + HasAudio bool `json:"hasAudio"` + + // True if sources of this type provide video + HasVideo bool `json:"hasVideo"` + + // True if source of this type provide frames asynchronously + IsAsync bool `json:"isAsync"` + + // True if sources of this type composite one or more sub-sources + IsComposite bool `json:"isComposite"` +} + +type Type struct { + Caps *Caps `json:"caps,omitempty"` + + // Default settings of this source type + DefaultSettings map[string]interface{} `json:"defaultSettings,omitempty"` + + // Display name of the source type + DisplayName string `json:"displayName,omitempty"` + + // Type. Value is one of the following: "input", "filter", "transition" or "other" + Type string `json:"type,omitempty"` + + // Non-unique internal source type ID + TypeId string `json:"typeId,omitempty"` +} + +// GetSourceTypesList sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetSourceTypesList(paramss ...*GetSourceTypesListParams) (*GetSourceTypesListResponse, error) { + if len(paramss) == 0 { + paramss = []*GetSourceTypesListParams{{}} + } + params := paramss[0] + data := &GetSourceTypesListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getspecialsources.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getspecialsources.go @@ -0,0 +1,57 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSpecialSourcesParams represents the params body for the "GetSpecialSources" request. +Get configured special sources like Desktop Audio and Mic/Aux sources. +Since 4.1.0. +*/ +type GetSpecialSourcesParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetSpecialSources". +func (o *GetSpecialSourcesParams) GetSelfName() string { + return "GetSpecialSources" +} + +/* +GetSpecialSourcesResponse represents the response body for the "GetSpecialSources" request. +Get configured special sources like Desktop Audio and Mic/Aux sources. +Since v4.1.0. +*/ +type GetSpecialSourcesResponse struct { + requests.ResponseBasic + + // Name of the first Desktop Audio capture source. + Desktop1 string `json:"desktop-1,omitempty"` + + // Name of the second Desktop Audio capture source. + Desktop2 string `json:"desktop-2,omitempty"` + + // Name of the first Mic/Aux input source. + Mic1 string `json:"mic-1,omitempty"` + + // Name of the second Mic/Aux input source. + Mic2 string `json:"mic-2,omitempty"` + + // NAme of the third Mic/Aux input source. + Mic3 string `json:"mic-3,omitempty"` +} + +// GetSpecialSources sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetSpecialSources(paramss ...*GetSpecialSourcesParams) (*GetSpecialSourcesResponse, error) { + if len(paramss) == 0 { + paramss = []*GetSpecialSourcesParams{{}} + } + params := paramss[0] + data := &GetSpecialSourcesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsyncoffset.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getsyncoffset.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetSyncOffsetParams represents the params body for the "GetSyncOffset" request. +Get the audio sync offset of a specified source. +Since 4.2.0. +*/ +type GetSyncOffsetParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "GetSyncOffset". +func (o *GetSyncOffsetParams) GetSelfName() string { + return "GetSyncOffset" +} + +/* +GetSyncOffsetResponse represents the response body for the "GetSyncOffset" request. +Get the audio sync offset of a specified source. +Since v4.2.0. +*/ +type GetSyncOffsetResponse struct { + requests.ResponseBasic + + // Source name. + Name string `json:"name,omitempty"` + + // The audio sync offset (in nanoseconds). + Offset int `json:"offset,omitempty"` +} + +// GetSyncOffset sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetSyncOffset(params *GetSyncOffsetParams) (*GetSyncOffsetResponse, error) { + data := &GetSyncOffsetResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextfreetype2properties.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextfreetype2properties.go @@ -0,0 +1,81 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetTextFreetype2PropertiesParams represents the params body for the "GetTextFreetype2Properties" request. +Get the current properties of a Text Freetype 2 source. +Since 4.5.0. +*/ +type GetTextFreetype2PropertiesParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "GetTextFreetype2Properties". +func (o *GetTextFreetype2PropertiesParams) GetSelfName() string { + return "GetTextFreetype2Properties" +} + +/* +GetTextFreetype2PropertiesResponse represents the response body for the "GetTextFreetype2Properties" request. +Get the current properties of a Text Freetype 2 source. +Since v4.5.0. +*/ +type GetTextFreetype2PropertiesResponse struct { + requests.ResponseBasic + + // Gradient top color. + Color1 int `json:"color1,omitempty"` + + // Gradient bottom color. + Color2 int `json:"color2,omitempty"` + + // Custom width (0 to disable). + CustomWidth int `json:"custom_width,omitempty"` + + // Drop shadow. + DropShadow bool `json:"drop_shadow"` + + // The font specification for this object. + Font *typedefs.Font `json:"font,omitempty"` + + // Read text from the specified file. + FromFile bool `json:"from_file"` + + // Chat log. + LogMode bool `json:"log_mode"` + + // Outline. + Outline bool `json:"outline"` + + // Source name + Source string `json:"source,omitempty"` + + // Text content to be displayed. + Text string `json:"text,omitempty"` + + // File path. + TextFile string `json:"text_file,omitempty"` + + // Word wrap. + WordWrap bool `json:"word_wrap"` +} + +// GetTextFreetype2Properties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetTextFreetype2Properties( + params *GetTextFreetype2PropertiesParams, +) (*GetTextFreetype2PropertiesResponse, error) { + data := &GetTextFreetype2PropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextgdiplusproperties.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettextgdiplusproperties.go @@ -0,0 +1,117 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetTextGDIPlusPropertiesParams represents the params body for the "GetTextGDIPlusProperties" request. +Get the current properties of a Text GDI Plus source. +Since 4.1.0. +*/ +type GetTextGDIPlusPropertiesParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "GetTextGDIPlusProperties". +func (o *GetTextGDIPlusPropertiesParams) GetSelfName() string { + return "GetTextGDIPlusProperties" +} + +/* +GetTextGDIPlusPropertiesResponse represents the response body for the "GetTextGDIPlusProperties" request. +Get the current properties of a Text GDI Plus source. +Since v4.1.0. +*/ +type GetTextGDIPlusPropertiesResponse struct { + requests.ResponseBasic + + // Text Alignment ("left", "center", "right"). + Align string `json:"align,omitempty"` + + // Background color. + BkColor int `json:"bk_color,omitempty"` + + // Background opacity (0-100). + BkOpacity int `json:"bk_opacity,omitempty"` + + // Chat log. + Chatlog bool `json:"chatlog"` + + // Chat log lines. + ChatlogLines int `json:"chatlog_lines,omitempty"` + + // Text color. + Color int `json:"color,omitempty"` + + // Extents wrap. + Extents bool `json:"extents"` + + // Extents cx. + ExtentsCx int `json:"extents_cx,omitempty"` + + // Extents cy. + ExtentsCy int `json:"extents_cy,omitempty"` + + // File path name. + File string `json:"file,omitempty"` + + // The font specification for this object. + Font *typedefs.Font `json:"font,omitempty"` + + // Gradient enabled. + Gradient bool `json:"gradient"` + + // Gradient color. + GradientColor int `json:"gradient_color,omitempty"` + + // Gradient direction. + GradientDir float64 `json:"gradient_dir,omitempty"` + + // Gradient opacity (0-100). + GradientOpacity int `json:"gradient_opacity,omitempty"` + + // Outline. + Outline bool `json:"outline"` + + // Outline color. + OutlineColor int `json:"outline_color,omitempty"` + + // Outline opacity (0-100). + OutlineOpacity int `json:"outline_opacity,omitempty"` + + // Outline size. + OutlineSize int `json:"outline_size,omitempty"` + + // Read text from the specified file. + ReadFromFile bool `json:"read_from_file"` + + // Source name. + Source string `json:"source,omitempty"` + + // Text content to be displayed. + Text string `json:"text,omitempty"` + + // Text vertical alignment ("top", "center", "bottom"). + Valign string `json:"valign,omitempty"` + + // Vertical text enabled. + Vertical bool `json:"vertical"` +} + +// GetTextGDIPlusProperties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetTextGDIPlusProperties( + params *GetTextGDIPlusPropertiesParams, +) (*GetTextGDIPlusPropertiesResponse, error) { + data := &GetTextGDIPlusPropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettracks.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.gettracks.go @@ -0,0 +1,52 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetTracksParams represents the params body for the "GetTracks" request. +Gets whether an audio track is active for a source. +Since 4.9.1. +*/ +type GetTracksParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "GetTracks". +func (o *GetTracksParams) GetSelfName() string { + return "GetTracks" +} + +/* +GetTracksResponse represents the response body for the "GetTracks" request. +Gets whether an audio track is active for a source. +Since v4.9.1. +*/ +type GetTracksResponse struct { + requests.ResponseBasic + + Track1 bool `json:"track1"` + + Track2 bool `json:"track2"` + + Track3 bool `json:"track3"` + + Track4 bool `json:"track4"` + + Track5 bool `json:"track5"` + + Track6 bool `json:"track6"` +} + +// GetTracks sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetTracks(params *GetTracksParams) (*GetTracksResponse, error) { + data := &GetTracksResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getvolume.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.getvolume.go @@ -0,0 +1,52 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetVolumeParams represents the params body for the "GetVolume" request. +Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE. +Since 4.0.0. +*/ +type GetVolumeParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` + + // Output volume in decibels of attenuation instead of amplitude/mul. + UseDecibel bool `json:"useDecibel"` +} + +// GetSelfName just returns "GetVolume". +func (o *GetVolumeParams) GetSelfName() string { + return "GetVolume" +} + +/* +GetVolumeResponse represents the response body for the "GetVolume" request. +Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE. +Since v4.0.0. +*/ +type GetVolumeResponse struct { + requests.ResponseBasic + + // Indicates whether the source is muted. + Muted bool `json:"muted"` + + // Source name. + Name string `json:"name,omitempty"` + + // Volume of the source. Between `0.0` and `20.0` if using mul, under `26.0` if using dB. + Volume float64 `json:"volume,omitempty"` +} + +// GetVolume sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetVolume(params *GetVolumeParams) (*GetVolumeResponse, error) { + data := &GetVolumeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.movesourcefilter.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.movesourcefilter.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +MoveSourceFilterParams represents the params body for the "MoveSourceFilter" request. +Move a filter in the chain (relative positioning) +Since 4.5.0. +*/ +type MoveSourceFilterParams struct { + requests.ParamsBasic + + // Name of the filter to reorder + FilterName string `json:"filterName,omitempty"` + + // How to move the filter around in the source's filter chain. Either "up", "down", "top" or "bottom". + MovementType string `json:"movementType,omitempty"` + + // Name of the source to which the filter belongs + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "MoveSourceFilter". +func (o *MoveSourceFilterParams) GetSelfName() string { + return "MoveSourceFilter" +} + +/* +MoveSourceFilterResponse represents the response body for the "MoveSourceFilter" request. +Move a filter in the chain (relative positioning) +Since v4.5.0. +*/ +type MoveSourceFilterResponse struct { + requests.ResponseBasic +} + +// MoveSourceFilter sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) MoveSourceFilter(params *MoveSourceFilterParams) (*MoveSourceFilterResponse, error) { + data := &MoveSourceFilterResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.refreshbrowsersource.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.refreshbrowsersource.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +RefreshBrowserSourceParams represents the params body for the "RefreshBrowserSource" request. +Refreshes the specified browser source. +Since 4.9.0. +*/ +type RefreshBrowserSourceParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "RefreshBrowserSource". +func (o *RefreshBrowserSourceParams) GetSelfName() string { + return "RefreshBrowserSource" +} + +/* +RefreshBrowserSourceResponse represents the response body for the "RefreshBrowserSource" request. +Refreshes the specified browser source. +Since v4.9.0. +*/ +type RefreshBrowserSourceResponse struct { + requests.ResponseBasic +} + +// RefreshBrowserSource sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) RefreshBrowserSource(params *RefreshBrowserSourceParams) (*RefreshBrowserSourceResponse, error) { + data := &RefreshBrowserSourceResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.removefilterfromsource.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.removefilterfromsource.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +RemoveFilterFromSourceParams represents the params body for the "RemoveFilterFromSource" request. +Remove a filter from a source +Since 4.5.0. +*/ +type RemoveFilterFromSourceParams struct { + requests.ParamsBasic + + // Name of the filter to remove + FilterName string `json:"filterName,omitempty"` + + // Name of the source from which the specified filter is removed + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "RemoveFilterFromSource". +func (o *RemoveFilterFromSourceParams) GetSelfName() string { + return "RemoveFilterFromSource" +} + +/* +RemoveFilterFromSourceResponse represents the response body for the "RemoveFilterFromSource" request. +Remove a filter from a source +Since v4.5.0. +*/ +type RemoveFilterFromSourceResponse struct { + requests.ResponseBasic +} + +// RemoveFilterFromSource sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) RemoveFilterFromSource(params *RemoveFilterFromSourceParams) (*RemoveFilterFromSourceResponse, error) { + data := &RemoveFilterFromSourceResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.reordersourcefilter.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.reordersourcefilter.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ReorderSourceFilterParams represents the params body for the "ReorderSourceFilter" request. +Move a filter in the chain (absolute index positioning) +Since 4.5.0. +*/ +type ReorderSourceFilterParams struct { + requests.ParamsBasic + + // Name of the filter to reorder + FilterName string `json:"filterName,omitempty"` + + // Desired position of the filter in the chain + NewIndex int `json:"newIndex,omitempty"` + + // Name of the source to which the filter belongs + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "ReorderSourceFilter". +func (o *ReorderSourceFilterParams) GetSelfName() string { + return "ReorderSourceFilter" +} + +/* +ReorderSourceFilterResponse represents the response body for the "ReorderSourceFilter" request. +Move a filter in the chain (absolute index positioning) +Since v4.5.0. +*/ +type ReorderSourceFilterResponse struct { + requests.ResponseBasic +} + +// ReorderSourceFilter sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ReorderSourceFilter(params *ReorderSourceFilterParams) (*ReorderSourceFilterResponse, error) { + data := &ReorderSourceFilterResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setaudiomonitortype.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setaudiomonitortype.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetAudioMonitorTypeParams represents the params body for the "SetAudioMonitorType" request. +Set the audio monitoring type of the specified source. +Since 4.8.0. +*/ +type SetAudioMonitorTypeParams struct { + requests.ParamsBasic + + // The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`. + MonitorType string `json:"monitorType,omitempty"` + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "SetAudioMonitorType". +func (o *SetAudioMonitorTypeParams) GetSelfName() string { + return "SetAudioMonitorType" +} + +/* +SetAudioMonitorTypeResponse represents the response body for the "SetAudioMonitorType" request. +Set the audio monitoring type of the specified source. +Since v4.8.0. +*/ +type SetAudioMonitorTypeResponse struct { + requests.ResponseBasic +} + +// SetAudioMonitorType sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetAudioMonitorType(params *SetAudioMonitorTypeParams) (*SetAudioMonitorTypeResponse, error) { + data := &SetAudioMonitorTypeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setmute.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setmute.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetMuteParams represents the params body for the "SetMute" request. +Sets the mute status of a specified source. +Since 4.0.0. +*/ +type SetMuteParams struct { + requests.ParamsBasic + + // Desired mute status. + Mute bool `json:"mute"` + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "SetMute". +func (o *SetMuteParams) GetSelfName() string { + return "SetMute" +} + +/* +SetMuteResponse represents the response body for the "SetMute" request. +Sets the mute status of a specified source. +Since v4.0.0. +*/ +type SetMuteResponse struct { + requests.ResponseBasic +} + +// SetMute sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetMute(params *SetMuteParams) (*SetMuteResponse, error) { + data := &SetMuteResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltersettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltersettings.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSourceFilterSettingsParams represents the params body for the "SetSourceFilterSettings" request. +Update settings of a filter +Since 4.5.0. +*/ +type SetSourceFilterSettingsParams struct { + requests.ParamsBasic + + // Name of the filter to reconfigure + FilterName string `json:"filterName,omitempty"` + + // New settings. These will be merged to the current filter settings. + FilterSettings map[string]interface{} `json:"filterSettings,omitempty"` + + // Name of the source to which the filter belongs + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "SetSourceFilterSettings". +func (o *SetSourceFilterSettingsParams) GetSelfName() string { + return "SetSourceFilterSettings" +} + +/* +SetSourceFilterSettingsResponse represents the response body for the "SetSourceFilterSettings" request. +Update settings of a filter +Since v4.5.0. +*/ +type SetSourceFilterSettingsResponse struct { + requests.ResponseBasic +} + +// SetSourceFilterSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSourceFilterSettings( + params *SetSourceFilterSettingsParams, +) (*SetSourceFilterSettingsResponse, error) { + data := &SetSourceFilterSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltervisibility.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcefiltervisibility.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSourceFilterVisibilityParams represents the params body for the "SetSourceFilterVisibility" request. +Change the visibility/enabled state of a filter +Since 4.7.0. +*/ +type SetSourceFilterVisibilityParams struct { + requests.ParamsBasic + + // New filter state + FilterEnabled bool `json:"filterEnabled"` + + // Source filter name + FilterName string `json:"filterName,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "SetSourceFilterVisibility". +func (o *SetSourceFilterVisibilityParams) GetSelfName() string { + return "SetSourceFilterVisibility" +} + +/* +SetSourceFilterVisibilityResponse represents the response body for the "SetSourceFilterVisibility" request. +Change the visibility/enabled state of a filter +Since v4.7.0. +*/ +type SetSourceFilterVisibilityResponse struct { + requests.ResponseBasic +} + +// SetSourceFilterVisibility sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSourceFilterVisibility( + params *SetSourceFilterVisibilityParams, +) (*SetSourceFilterVisibilityResponse, error) { + data := &SetSourceFilterVisibilityResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcename.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcename.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSourceNameParams represents the params body for the "SetSourceName" request. +Sets (aka rename) the name of a source. Also works with scenes since scenes are technically sources in OBS. + +Note: If the new name already exists as a source, obs-websocket will return an error. +Since 4.8.0. +*/ +type SetSourceNameParams struct { + requests.ParamsBasic + + // New source name. + NewName string `json:"newName,omitempty"` + + // Source name. + SourceName string `json:"sourceName,omitempty"` +} + +// GetSelfName just returns "SetSourceName". +func (o *SetSourceNameParams) GetSelfName() string { + return "SetSourceName" +} + +/* +SetSourceNameResponse represents the response body for the "SetSourceName" request. +Sets (aka rename) the name of a source. Also works with scenes since scenes are technically sources in OBS. + +Note: If the new name already exists as a source, obs-websocket will return an error. +Since v4.8.0. +*/ +type SetSourceNameResponse struct { + requests.ResponseBasic +} + +// SetSourceName sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSourceName(params *SetSourceNameParams) (*SetSourceNameResponse, error) { + data := &SetSourceNameResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcesettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsourcesettings.go @@ -0,0 +1,56 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSourceSettingsParams represents the params body for the "SetSourceSettings" request. +Set settings of the specified source. +Since 4.3.0. +*/ +type SetSourceSettingsParams struct { + requests.ParamsBasic + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Source settings (varies between source types, may require some probing around). + SourceSettings map[string]interface{} `json:"sourceSettings,omitempty"` + + // Type of the specified source. Useful for type-checking to avoid settings a set of settings incompatible with the + // actual source's type. + SourceType string `json:"sourceType,omitempty"` +} + +// GetSelfName just returns "SetSourceSettings". +func (o *SetSourceSettingsParams) GetSelfName() string { + return "SetSourceSettings" +} + +/* +SetSourceSettingsResponse represents the response body for the "SetSourceSettings" request. +Set settings of the specified source. +Since v4.3.0. +*/ +type SetSourceSettingsResponse struct { + requests.ResponseBasic + + // Source name + SourceName string `json:"sourceName,omitempty"` + + // Updated source settings + SourceSettings map[string]interface{} `json:"sourceSettings,omitempty"` + + // Type of the specified source + SourceType string `json:"sourceType,omitempty"` +} + +// SetSourceSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSourceSettings(params *SetSourceSettingsParams) (*SetSourceSettingsResponse, error) { + data := &SetSourceSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsyncoffset.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setsyncoffset.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetSyncOffsetParams represents the params body for the "SetSyncOffset" request. +Set the audio sync offset of a specified source. +Since 4.2.0. +*/ +type SetSyncOffsetParams struct { + requests.ParamsBasic + + // The desired audio sync offset (in nanoseconds). + Offset int `json:"offset,omitempty"` + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "SetSyncOffset". +func (o *SetSyncOffsetParams) GetSelfName() string { + return "SetSyncOffset" +} + +/* +SetSyncOffsetResponse represents the response body for the "SetSyncOffset" request. +Set the audio sync offset of a specified source. +Since v4.2.0. +*/ +type SetSyncOffsetResponse struct { + requests.ResponseBasic +} + +// SetSyncOffset sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetSyncOffset(params *SetSyncOffsetParams) (*SetSyncOffsetResponse, error) { + data := &SetSyncOffsetResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextfreetype2properties.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextfreetype2properties.go @@ -0,0 +1,78 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +SetTextFreetype2PropertiesParams represents the params body for the "SetTextFreetype2Properties" request. +Set the current properties of a Text Freetype 2 source. +Since 4.5.0. +*/ +type SetTextFreetype2PropertiesParams struct { + requests.ParamsBasic + + // Gradient top color. + Color1 int `json:"color1,omitempty"` + + // Gradient bottom color. + Color2 int `json:"color2,omitempty"` + + // Custom width (0 to disable). + CustomWidth int `json:"custom_width,omitempty"` + + // Drop shadow. + DropShadow bool `json:"drop_shadow"` + + // The font specification for this object. + Font *typedefs.Font `json:"font,omitempty"` + + // Read text from the specified file. + FromFile bool `json:"from_file"` + + // Chat log. + LogMode bool `json:"log_mode"` + + // Outline. + Outline bool `json:"outline"` + + // Source name. + Source string `json:"source,omitempty"` + + // Text content to be displayed. + Text string `json:"text,omitempty"` + + // File path. + TextFile string `json:"text_file,omitempty"` + + // Word wrap. + WordWrap bool `json:"word_wrap"` +} + +// GetSelfName just returns "SetTextFreetype2Properties". +func (o *SetTextFreetype2PropertiesParams) GetSelfName() string { + return "SetTextFreetype2Properties" +} + +/* +SetTextFreetype2PropertiesResponse represents the response body for the "SetTextFreetype2Properties" request. +Set the current properties of a Text Freetype 2 source. +Since v4.5.0. +*/ +type SetTextFreetype2PropertiesResponse struct { + requests.ResponseBasic +} + +// SetTextFreetype2Properties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTextFreetype2Properties( + params *SetTextFreetype2PropertiesParams, +) (*SetTextFreetype2PropertiesResponse, error) { + data := &SetTextFreetype2PropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextgdiplusproperties.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settextgdiplusproperties.go @@ -0,0 +1,117 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +SetTextGDIPlusPropertiesParams represents the params body for the "SetTextGDIPlusProperties" request. +Set the current properties of a Text GDI Plus source. +Since 4.1.0. +*/ +type SetTextGDIPlusPropertiesParams struct { + requests.ParamsBasic + + // Text Alignment ("left", "center", "right"). + Align string `json:"align,omitempty"` + + // Background color. + BkColor int `json:"bk_color,omitempty"` + + // Background opacity (0-100). + BkOpacity int `json:"bk_opacity,omitempty"` + + // Chat log. + Chatlog bool `json:"chatlog"` + + // Chat log lines. + ChatlogLines int `json:"chatlog_lines,omitempty"` + + // Text color. + Color int `json:"color,omitempty"` + + // Extents wrap. + Extents bool `json:"extents"` + + // Extents cx. + ExtentsCx int `json:"extents_cx,omitempty"` + + // Extents cy. + ExtentsCy int `json:"extents_cy,omitempty"` + + // File path name. + File string `json:"file,omitempty"` + + // The font specification for this object. + Font *typedefs.Font `json:"font,omitempty"` + + // Gradient enabled. + Gradient bool `json:"gradient"` + + // Gradient color. + GradientColor int `json:"gradient_color,omitempty"` + + // Gradient direction. + GradientDir float64 `json:"gradient_dir,omitempty"` + + // Gradient opacity (0-100). + GradientOpacity int `json:"gradient_opacity,omitempty"` + + // Outline. + Outline bool `json:"outline"` + + // Outline color. + OutlineColor int `json:"outline_color,omitempty"` + + // Outline opacity (0-100). + OutlineOpacity int `json:"outline_opacity,omitempty"` + + // Outline size. + OutlineSize int `json:"outline_size,omitempty"` + + // Read text from the specified file. + ReadFromFile bool `json:"read_from_file"` + + // Visibility of the scene item. + Render bool `json:"render"` + + // Name of the source. + Source string `json:"source,omitempty"` + + // Text content to be displayed. + Text string `json:"text,omitempty"` + + // Text vertical alignment ("top", "center", "bottom"). + Valign string `json:"valign,omitempty"` + + // Vertical text enabled. + Vertical bool `json:"vertical"` +} + +// GetSelfName just returns "SetTextGDIPlusProperties". +func (o *SetTextGDIPlusPropertiesParams) GetSelfName() string { + return "SetTextGDIPlusProperties" +} + +/* +SetTextGDIPlusPropertiesResponse represents the response body for the "SetTextGDIPlusProperties" request. +Set the current properties of a Text GDI Plus source. +Since v4.1.0. +*/ +type SetTextGDIPlusPropertiesResponse struct { + requests.ResponseBasic +} + +// SetTextGDIPlusProperties sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTextGDIPlusProperties( + params *SetTextGDIPlusPropertiesParams, +) (*SetTextGDIPlusPropertiesResponse, error) { + data := &SetTextGDIPlusPropertiesResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settracks.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.settracks.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetTracksParams represents the params body for the "SetTracks" request. +Changes whether an audio track is active for a source. +Since 4.9.1. +*/ +type SetTracksParams struct { + requests.ParamsBasic + + // Whether audio track is active or not. + Active bool `json:"active"` + + // Source name. + SourceName string `json:"sourceName,omitempty"` + + // Audio tracks 1-6. + Track int `json:"track,omitempty"` +} + +// GetSelfName just returns "SetTracks". +func (o *SetTracksParams) GetSelfName() string { + return "SetTracks" +} + +/* +SetTracksResponse represents the response body for the "SetTracks" request. +Changes whether an audio track is active for a source. +Since v4.9.1. +*/ +type SetTracksResponse struct { + requests.ResponseBasic +} + +// SetTracks sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTracks(params *SetTracksParams) (*SetTracksResponse, error) { + data := &SetTracksResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setvolume.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.setvolume.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetVolumeParams represents the params body for the "SetVolume" request. +Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE. +Since 4.0.0. +*/ +type SetVolumeParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` + + // Interperet `volume` data as decibels instead of amplitude/mul. + UseDecibel bool `json:"useDecibel"` + + // Desired volume. Must be between `0.0` and `20.0` for mul, and under 26.0 for dB. OBS will interpret dB values + // under -100.0 as Inf. Note: The OBS volume sliders only reach a maximum of 1.0mul/0.0dB, however OBS actually + // supports larger values. + Volume float64 `json:"volume,omitempty"` +} + +// GetSelfName just returns "SetVolume". +func (o *SetVolumeParams) GetSelfName() string { + return "SetVolume" +} + +/* +SetVolumeResponse represents the response body for the "SetVolume" request. +Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE. +Since v4.0.0. +*/ +type SetVolumeResponse struct { + requests.ResponseBasic +} + +// SetVolume sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetVolume(params *SetVolumeParams) (*SetVolumeResponse, error) { + data := &SetVolumeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.takesourcescreenshot.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.takesourcescreenshot.go @@ -0,0 +1,82 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +TakeSourceScreenshotParams represents the params body for the "TakeSourceScreenshot" request. +Takes a picture snapshot of a source and then can either or both: - Send it over as a Data URI (base64-encoded data) in the response (by specifying `embedPictureFormat` in the request) - Save it to disk (by specifying `saveToFilePath` in the request) + +At least `embedPictureFormat` or `saveToFilePath` must be specified. + +Clients can specify `width` and `height` parameters to receive scaled pictures. Aspect ratio is +preserved if only one of these two parameters is specified. +Since 4.6.0. +*/ +type TakeSourceScreenshotParams struct { + requests.ParamsBasic + + // Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most + // compression, 100 is largest file/least compression. Varies with image type. + CompressionQuality int `json:"compressionQuality,omitempty"` + + // Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by + // Qt's Image module) + EmbedPictureFormat string `json:"embedPictureFormat,omitempty"` + + // Format to save the image file as (one of the values provided in the `supported-image-export-formats` response + // field of `GetVersion`). If not specified, tries to guess based on file extension. + FileFormat string `json:"fileFormat,omitempty"` + + // Screenshot height. Defaults to the source's base height. + Height int `json:"height,omitempty"` + + // Full file path (file extension included) where the captured image is to be saved. Can be in a format different + // from `pictureFormat`. Can be a relative path. + SaveToFilePath string `json:"saveToFilePath,omitempty"` + + // Source name. Note: Since scenes are also sources, you can also provide a scene name. If not provided, the + // currently active scene is used. + SourceName string `json:"sourceName,omitempty"` + + // Screenshot width. Defaults to the source's base width. + Width int `json:"width,omitempty"` +} + +// GetSelfName just returns "TakeSourceScreenshot". +func (o *TakeSourceScreenshotParams) GetSelfName() string { + return "TakeSourceScreenshot" +} + +/* +TakeSourceScreenshotResponse represents the response body for the "TakeSourceScreenshot" request. +Takes a picture snapshot of a source and then can either or both: - Send it over as a Data URI (base64-encoded data) in the response (by specifying `embedPictureFormat` in the request) - Save it to disk (by specifying `saveToFilePath` in the request) + +At least `embedPictureFormat` or `saveToFilePath` must be specified. + +Clients can specify `width` and `height` parameters to receive scaled pictures. Aspect ratio is +preserved if only one of these two parameters is specified. +Since v4.6.0. +*/ +type TakeSourceScreenshotResponse struct { + requests.ResponseBasic + + // Absolute path to the saved image file (if `saveToFilePath` was specified in the request) + ImageFile string `json:"imageFile,omitempty"` + + // Image Data URI (if `embedPictureFormat` was specified in the request) + Img string `json:"img,omitempty"` + + // Source name + SourceName string `json:"sourceName,omitempty"` +} + +// TakeSourceScreenshot sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) TakeSourceScreenshot(params *TakeSourceScreenshotParams) (*TakeSourceScreenshotResponse, error) { + data := &TakeSourceScreenshotResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.togglemute.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/xx_generated.togglemute.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ToggleMuteParams represents the params body for the "ToggleMute" request. +Inverts the mute status of a specified source. +Since 4.0.0. +*/ +type ToggleMuteParams struct { + requests.ParamsBasic + + // Source name. + Source string `json:"source,omitempty"` +} + +// GetSelfName just returns "ToggleMute". +func (o *ToggleMuteParams) GetSelfName() string { + return "ToggleMute" +} + +/* +ToggleMuteResponse represents the response body for the "ToggleMute" request. +Inverts the mute status of a specified source. +Since v4.0.0. +*/ +type ToggleMuteResponse struct { + requests.ResponseBasic +} + +// ToggleMute sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) ToggleMute(params *ToggleMuteParams) (*ToggleMuteResponse, error) { + data := &ToggleMuteResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/sources/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/sources/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package sources + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'sources' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamingstatus.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamingstatus.go @@ -0,0 +1,66 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetStreamingStatusParams represents the params body for the "GetStreamingStatus" request. +Get current streaming and recording status. +Since 0.3. +*/ +type GetStreamingStatusParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetStreamingStatus". +func (o *GetStreamingStatusParams) GetSelfName() string { + return "GetStreamingStatus" +} + +/* +GetStreamingStatusResponse represents the response body for the "GetStreamingStatus" request. +Get current streaming and recording status. +Since v0.3. +*/ +type GetStreamingStatusResponse struct { + requests.ResponseBasic + + // Always false. Retrocompatibility with OBSRemote. + PreviewOnly bool `json:"preview-only"` + + // Time elapsed since recording started (only present if currently recording). + RecTimecode string `json:"rec-timecode,omitempty"` + + // Current recording status. + Recording bool `json:"recording"` + + // If recording is paused. + RecordingPaused bool `json:"recording-paused"` + + // Time elapsed since streaming started (only present if currently streaming). + StreamTimecode string `json:"stream-timecode,omitempty"` + + // Current streaming status. + Streaming bool `json:"streaming"` + + // Current virtual cam status. + Virtualcam bool `json:"virtualcam"` + + // Time elapsed since virtual cam started (only present if virtual cam currently active). + VirtualcamTimecode string `json:"virtualcam-timecode,omitempty"` +} + +// GetStreamingStatus sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetStreamingStatus(paramss ...*GetStreamingStatusParams) (*GetStreamingStatusResponse, error) { + if len(paramss) == 0 { + paramss = []*GetStreamingStatusParams{{}} + } + params := paramss[0] + data := &GetStreamingStatusResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.getstreamsettings.go @@ -0,0 +1,51 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetStreamSettingsParams represents the params body for the "GetStreamSettings" request. +Get the current streaming server settings. +Since 4.1.0. +*/ +type GetStreamSettingsParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetStreamSettings". +func (o *GetStreamSettingsParams) GetSelfName() string { + return "GetStreamSettings" +} + +/* +GetStreamSettingsResponse represents the response body for the "GetStreamSettings" request. +Get the current streaming server settings. +Since v4.1.0. +*/ +type GetStreamSettingsResponse struct { + requests.ResponseBasic + + // + Settings *typedefs.StreamSettings `json:"settings,omitempty"` + + // The type of streaming service configuration. Possible values: 'rtmp_custom' or 'rtmp_common'. + Type string `json:"type,omitempty"` +} + +// GetStreamSettings sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetStreamSettings(paramss ...*GetStreamSettingsParams) (*GetStreamSettingsResponse, error) { + if len(paramss) == 0 { + paramss = []*GetStreamSettingsParams{{}} + } + params := paramss[0] + data := &GetStreamSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.savestreamsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.savestreamsettings.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SaveStreamSettingsParams represents the params body for the "SaveStreamSettings" request. +Save the current streaming server settings to disk. +Since 4.1.0. +*/ +type SaveStreamSettingsParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "SaveStreamSettings". +func (o *SaveStreamSettingsParams) GetSelfName() string { + return "SaveStreamSettings" +} + +/* +SaveStreamSettingsResponse represents the response body for the "SaveStreamSettings" request. +Save the current streaming server settings to disk. +Since v4.1.0. +*/ +type SaveStreamSettingsResponse struct { + requests.ResponseBasic +} + +// SaveStreamSettings sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) SaveStreamSettings(paramss ...*SaveStreamSettingsParams) (*SaveStreamSettingsResponse, error) { + if len(paramss) == 0 { + paramss = []*SaveStreamSettingsParams{{}} + } + params := paramss[0] + data := &SaveStreamSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.sendcaptions.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.sendcaptions.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SendCaptionsParams represents the params body for the "SendCaptions" request. +Send the provided text as embedded CEA-608 caption data. +Since 4.6.0. +*/ +type SendCaptionsParams struct { + requests.ParamsBasic + + // Captions text + Text string `json:"text,omitempty"` +} + +// GetSelfName just returns "SendCaptions". +func (o *SendCaptionsParams) GetSelfName() string { + return "SendCaptions" +} + +/* +SendCaptionsResponse represents the response body for the "SendCaptions" request. +Send the provided text as embedded CEA-608 caption data. +Since v4.6.0. +*/ +type SendCaptionsResponse struct { + requests.ResponseBasic +} + +// SendCaptions sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SendCaptions(params *SendCaptionsParams) (*SendCaptionsResponse, error) { + data := &SendCaptionsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.setstreamsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.setstreamsettings.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +SetStreamSettingsParams represents the params body for the "SetStreamSettings" request. +Sets one or more attributes of the current streaming server settings. Any options not passed will remain unchanged. Returns the updated settings in response. If 'type' is different than the current streaming service type, all settings are required. Returns the full settings of the stream (the same as GetStreamSettings). +Since 4.1.0. +*/ +type SetStreamSettingsParams struct { + requests.ParamsBasic + + // Persist the settings to disk. + Save bool `json:"save"` + + // + Settings *typedefs.StreamSettings `json:"settings,omitempty"` + + // The type of streaming service configuration, usually `rtmp_custom` or `rtmp_common`. + Type string `json:"type,omitempty"` +} + +// GetSelfName just returns "SetStreamSettings". +func (o *SetStreamSettingsParams) GetSelfName() string { + return "SetStreamSettings" +} + +/* +SetStreamSettingsResponse represents the response body for the "SetStreamSettings" request. +Sets one or more attributes of the current streaming server settings. Any options not passed will remain unchanged. Returns the updated settings in response. If 'type' is different than the current streaming service type, all settings are required. Returns the full settings of the stream (the same as GetStreamSettings). +Since v4.1.0. +*/ +type SetStreamSettingsResponse struct { + requests.ResponseBasic +} + +// SetStreamSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetStreamSettings(params *SetStreamSettingsParams) (*SetStreamSettingsResponse, error) { + data := &SetStreamSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstopstreaming.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstopstreaming.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartStopStreamingParams represents the params body for the "StartStopStreaming" request. +Toggle streaming on or off (depending on the current stream state). +Since 0.3. +*/ +type StartStopStreamingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartStopStreaming". +func (o *StartStopStreamingParams) GetSelfName() string { + return "StartStopStreaming" +} + +/* +StartStopStreamingResponse represents the response body for the "StartStopStreaming" request. +Toggle streaming on or off (depending on the current stream state). +Since v0.3. +*/ +type StartStopStreamingResponse struct { + requests.ResponseBasic +} + +// StartStopStreaming sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) StartStopStreaming(paramss ...*StartStopStreamingParams) (*StartStopStreamingResponse, error) { + if len(paramss) == 0 { + paramss = []*StartStopStreamingParams{{}} + } + params := paramss[0] + data := &StartStopStreamingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstreaming.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.startstreaming.go @@ -0,0 +1,58 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +StartStreamingParams represents the params body for the "StartStreaming" request. +Start streaming. +Will return an `error` if streaming is already active. +Since 4.1.0. +*/ +type StartStreamingParams struct { + requests.ParamsBasic + + Stream *Stream `json:"stream,omitempty"` +} + +type Stream struct { + // Adds the given object parameters as encoded query string parameters to the 'key' of the RTMP stream. Used to pass + // data to the RTMP service about the streaming. May be any String, Numeric, or Boolean field. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // + Settings *typedefs.StreamSettings `json:"settings,omitempty"` + + // If specified ensures the type of stream matches the given type (usually 'rtmp_custom' or 'rtmp_common'). If the + // currently configured stream type does not match the given stream type, all settings must be specified in the + // `settings` object or an error will occur when starting the stream. + Type string `json:"type,omitempty"` +} + +// GetSelfName just returns "StartStreaming". +func (o *StartStreamingParams) GetSelfName() string { + return "StartStreaming" +} + +/* +StartStreamingResponse represents the response body for the "StartStreaming" request. +Start streaming. +Will return an `error` if streaming is already active. +Since v4.1.0. +*/ +type StartStreamingResponse struct { + requests.ResponseBasic +} + +// StartStreaming sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) StartStreaming(params *StartStreamingParams) (*StartStreamingResponse, error) { + data := &StartStreamingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.stopstreaming.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/xx_generated.stopstreaming.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopStreamingParams represents the params body for the "StopStreaming" request. +Stop streaming. +Will return an `error` if streaming is not active. +Since 4.1.0. +*/ +type StopStreamingParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StopStreaming". +func (o *StopStreamingParams) GetSelfName() string { + return "StopStreaming" +} + +/* +StopStreamingResponse represents the response body for the "StopStreaming" request. +Stop streaming. +Will return an `error` if streaming is not active. +Since v4.1.0. +*/ +type StopStreamingResponse struct { + requests.ResponseBasic +} + +// StopStreaming sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) StopStreaming(paramss ...*StopStreamingParams) (*StopStreamingResponse, error) { + if len(paramss) == 0 { + paramss = []*StopStreamingParams{{}} + } + params := paramss[0] + data := &StopStreamingResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/streaming/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/streaming/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package streaming + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'streaming' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.disablestudiomode.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.disablestudiomode.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +DisableStudioModeParams represents the params body for the "DisableStudioMode" request. +Disables Studio Mode. +Since 4.1.0. +*/ +type DisableStudioModeParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "DisableStudioMode". +func (o *DisableStudioModeParams) GetSelfName() string { + return "DisableStudioMode" +} + +/* +DisableStudioModeResponse represents the response body for the "DisableStudioMode" request. +Disables Studio Mode. +Since v4.1.0. +*/ +type DisableStudioModeResponse struct { + requests.ResponseBasic +} + +// DisableStudioMode sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) DisableStudioMode(paramss ...*DisableStudioModeParams) (*DisableStudioModeResponse, error) { + if len(paramss) == 0 { + paramss = []*DisableStudioModeParams{{}} + } + params := paramss[0] + data := &DisableStudioModeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.enablestudiomode.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.enablestudiomode.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +EnableStudioModeParams represents the params body for the "EnableStudioMode" request. +Enables Studio Mode. +Since 4.1.0. +*/ +type EnableStudioModeParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "EnableStudioMode". +func (o *EnableStudioModeParams) GetSelfName() string { + return "EnableStudioMode" +} + +/* +EnableStudioModeResponse represents the response body for the "EnableStudioMode" request. +Enables Studio Mode. +Since v4.1.0. +*/ +type EnableStudioModeResponse struct { + requests.ResponseBasic +} + +// EnableStudioMode sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) EnableStudioMode(paramss ...*EnableStudioModeParams) (*EnableStudioModeResponse, error) { + if len(paramss) == 0 { + paramss = []*EnableStudioModeParams{{}} + } + params := paramss[0] + data := &EnableStudioModeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getpreviewscene.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getpreviewscene.go @@ -0,0 +1,52 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import ( + requests "github.com/andreykaipov/goobs/api/requests" + typedefs "github.com/andreykaipov/goobs/api/typedefs" +) + +/* +GetPreviewSceneParams represents the params body for the "GetPreviewScene" request. +Get the name of the currently previewed scene and its list of sources. +Will return an `error` if Studio Mode is not enabled. +Since 4.1.0. +*/ +type GetPreviewSceneParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetPreviewScene". +func (o *GetPreviewSceneParams) GetSelfName() string { + return "GetPreviewScene" +} + +/* +GetPreviewSceneResponse represents the response body for the "GetPreviewScene" request. +Get the name of the currently previewed scene and its list of sources. +Will return an `error` if Studio Mode is not enabled. +Since v4.1.0. +*/ +type GetPreviewSceneResponse struct { + requests.ResponseBasic + + // The name of the active preview scene. + Name string `json:"name,omitempty"` + + Sources []typedefs.SceneItem `json:"sources,omitempty"` +} + +// GetPreviewScene sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetPreviewScene(paramss ...*GetPreviewSceneParams) (*GetPreviewSceneResponse, error) { + if len(paramss) == 0 { + paramss = []*GetPreviewSceneParams{{}} + } + params := paramss[0] + data := &GetPreviewSceneResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getstudiomodestatus.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.getstudiomodestatus.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetStudioModeStatusParams represents the params body for the "GetStudioModeStatus" request. +Indicates if Studio Mode is currently enabled. +Since 4.1.0. +*/ +type GetStudioModeStatusParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetStudioModeStatus". +func (o *GetStudioModeStatusParams) GetSelfName() string { + return "GetStudioModeStatus" +} + +/* +GetStudioModeStatusResponse represents the response body for the "GetStudioModeStatus" request. +Indicates if Studio Mode is currently enabled. +Since v4.1.0. +*/ +type GetStudioModeStatusResponse struct { + requests.ResponseBasic + + // Indicates if Studio Mode is enabled. + StudioMode bool `json:"studio-mode"` +} + +// GetStudioModeStatus sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetStudioModeStatus(paramss ...*GetStudioModeStatusParams) (*GetStudioModeStatusResponse, error) { + if len(paramss) == 0 { + paramss = []*GetStudioModeStatusParams{{}} + } + params := paramss[0] + data := &GetStudioModeStatusResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.setpreviewscene.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.setpreviewscene.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetPreviewSceneParams represents the params body for the "SetPreviewScene" request. +Set the active preview scene. +Will return an `error` if Studio Mode is not enabled. +Since 4.1.0. +*/ +type SetPreviewSceneParams struct { + requests.ParamsBasic + + // The name of the scene to preview. + SceneName string `json:"scene-name,omitempty"` +} + +// GetSelfName just returns "SetPreviewScene". +func (o *SetPreviewSceneParams) GetSelfName() string { + return "SetPreviewScene" +} + +/* +SetPreviewSceneResponse represents the response body for the "SetPreviewScene" request. +Set the active preview scene. +Will return an `error` if Studio Mode is not enabled. +Since v4.1.0. +*/ +type SetPreviewSceneResponse struct { + requests.ResponseBasic +} + +// SetPreviewScene sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetPreviewScene(params *SetPreviewSceneParams) (*SetPreviewSceneResponse, error) { + data := &SetPreviewSceneResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.togglestudiomode.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.togglestudiomode.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ToggleStudioModeParams represents the params body for the "ToggleStudioMode" request. +Toggles Studio Mode (depending on the current state of studio mode). +Since 4.1.0. +*/ +type ToggleStudioModeParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ToggleStudioMode". +func (o *ToggleStudioModeParams) GetSelfName() string { + return "ToggleStudioMode" +} + +/* +ToggleStudioModeResponse represents the response body for the "ToggleStudioMode" request. +Toggles Studio Mode (depending on the current state of studio mode). +Since v4.1.0. +*/ +type ToggleStudioModeResponse struct { + requests.ResponseBasic +} + +// ToggleStudioMode sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) ToggleStudioMode(paramss ...*ToggleStudioModeParams) (*ToggleStudioModeResponse, error) { + if len(paramss) == 0 { + paramss = []*ToggleStudioModeParams{{}} + } + params := paramss[0] + data := &ToggleStudioModeResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.transitiontoprogram.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/xx_generated.transitiontoprogram.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +TransitionToProgramParams represents the params body for the "TransitionToProgram" request. +Transitions the currently previewed scene to the main output. +Will return an `error` if Studio Mode is not enabled. +Since 4.1.0. +*/ +type TransitionToProgramParams struct { + requests.ParamsBasic + + WithTransition *WithTransition `json:"with-transition,omitempty"` +} + +type WithTransition struct { + // Transition duration (in milliseconds). + Duration int `json:"duration,omitempty"` + + // Name of the transition. + Name string `json:"name,omitempty"` +} + +// GetSelfName just returns "TransitionToProgram". +func (o *TransitionToProgramParams) GetSelfName() string { + return "TransitionToProgram" +} + +/* +TransitionToProgramResponse represents the response body for the "TransitionToProgram" request. +Transitions the currently previewed scene to the main output. +Will return an `error` if Studio Mode is not enabled. +Since v4.1.0. +*/ +type TransitionToProgramResponse struct { + requests.ResponseBasic +} + +// TransitionToProgram sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) TransitionToProgram(params *TransitionToProgramParams) (*TransitionToProgramResponse, error) { + data := &TransitionToProgramResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/studio_mode/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package studiomode + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'studio mode' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.getcurrenttransition.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.getcurrenttransition.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetCurrentTransitionParams represents the params body for the "GetCurrentTransition" request. +Get the name of the currently selected transition in the frontend's dropdown menu. +Since 0.3. +*/ +type GetCurrentTransitionParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetCurrentTransition". +func (o *GetCurrentTransitionParams) GetSelfName() string { + return "GetCurrentTransition" +} + +/* +GetCurrentTransitionResponse represents the response body for the "GetCurrentTransition" request. +Get the name of the currently selected transition in the frontend's dropdown menu. +Since v0.3. +*/ +type GetCurrentTransitionResponse struct { + requests.ResponseBasic + + // Transition duration (in milliseconds) if supported by the transition. + Duration int `json:"duration,omitempty"` + + // Name of the selected transition. + Name string `json:"name,omitempty"` +} + +// GetCurrentTransition sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetCurrentTransition(paramss ...*GetCurrentTransitionParams) (*GetCurrentTransitionResponse, error) { + if len(paramss) == 0 { + paramss = []*GetCurrentTransitionParams{{}} + } + params := paramss[0] + data := &GetCurrentTransitionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionduration.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionduration.go @@ -0,0 +1,47 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetTransitionDurationParams represents the params body for the "GetTransitionDuration" request. +Get the duration of the currently selected transition if supported. +Since 4.1.0. +*/ +type GetTransitionDurationParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetTransitionDuration". +func (o *GetTransitionDurationParams) GetSelfName() string { + return "GetTransitionDuration" +} + +/* +GetTransitionDurationResponse represents the response body for the "GetTransitionDuration" request. +Get the duration of the currently selected transition if supported. +Since v4.1.0. +*/ +type GetTransitionDurationResponse struct { + requests.ResponseBasic + + // Duration of the current transition (in milliseconds). + TransitionDuration int `json:"transition-duration,omitempty"` +} + +// GetTransitionDuration sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetTransitionDuration( + paramss ...*GetTransitionDurationParams, +) (*GetTransitionDurationResponse, error) { + if len(paramss) == 0 { + paramss = []*GetTransitionDurationParams{{}} + } + params := paramss[0] + data := &GetTransitionDurationResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionlist.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionlist.go @@ -0,0 +1,52 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetTransitionListParams represents the params body for the "GetTransitionList" request. +List of all transitions available in the frontend's dropdown menu. +Since 4.1.0. +*/ +type GetTransitionListParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetTransitionList". +func (o *GetTransitionListParams) GetSelfName() string { + return "GetTransitionList" +} + +/* +GetTransitionListResponse represents the response body for the "GetTransitionList" request. +List of all transitions available in the frontend's dropdown menu. +Since v4.1.0. +*/ +type GetTransitionListResponse struct { + requests.ResponseBasic + + // Name of the currently active transition. + CurrentTransition string `json:"current-transition,omitempty"` + + Transitions []*Transition `json:"transitions,omitempty"` +} + +type Transition struct { + // Name of the transition. + Name string `json:"name,omitempty"` +} + +// GetTransitionList sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) GetTransitionList(paramss ...*GetTransitionListParams) (*GetTransitionListResponse, error) { + if len(paramss) == 0 { + paramss = []*GetTransitionListParams{{}} + } + params := paramss[0] + data := &GetTransitionListResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionposition.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionposition.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetTransitionPositionParams represents the params body for the "GetTransitionPosition" request. +Get the position of the current transition. +Since 4.9.0. +*/ +type GetTransitionPositionParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetTransitionPosition". +func (o *GetTransitionPositionParams) GetSelfName() string { + return "GetTransitionPosition" +} + +/* +GetTransitionPositionResponse represents the response body for the "GetTransitionPosition" request. +Get the position of the current transition. +Since v4.9.0. +*/ +type GetTransitionPositionResponse struct { + requests.ResponseBasic + + // current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not + // active. + Position float64 `json:"position,omitempty"` +} + +// GetTransitionPosition sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetTransitionPosition( + paramss ...*GetTransitionPositionParams, +) (*GetTransitionPositionResponse, error) { + if len(paramss) == 0 { + paramss = []*GetTransitionPositionParams{{}} + } + params := paramss[0] + data := &GetTransitionPositionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.gettransitionsettings.go @@ -0,0 +1,43 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetTransitionSettingsParams represents the params body for the "GetTransitionSettings" request. +Get the current settings of a transition +Since 4.9.0. +*/ +type GetTransitionSettingsParams struct { + requests.ParamsBasic + + // Transition name + TransitionName string `json:"transitionName,omitempty"` +} + +// GetSelfName just returns "GetTransitionSettings". +func (o *GetTransitionSettingsParams) GetSelfName() string { + return "GetTransitionSettings" +} + +/* +GetTransitionSettingsResponse represents the response body for the "GetTransitionSettings" request. +Get the current settings of a transition +Since v4.9.0. +*/ +type GetTransitionSettingsResponse struct { + requests.ResponseBasic + + // Current transition settings + TransitionSettings map[string]interface{} `json:"transitionSettings,omitempty"` +} + +// GetTransitionSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) GetTransitionSettings(params *GetTransitionSettingsParams) (*GetTransitionSettingsResponse, error) { + data := &GetTransitionSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.releasetbar.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.releasetbar.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +ReleaseTBarParams represents the params body for the "ReleaseTBar" request. +Release the T-Bar (like a user releasing their mouse button after moving it). +*YOU MUST CALL THIS if you called `SetTBarPosition` with the `release` parameter set to `false`.* +Since 4.9.0. +*/ +type ReleaseTBarParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "ReleaseTBar". +func (o *ReleaseTBarParams) GetSelfName() string { + return "ReleaseTBar" +} + +/* +ReleaseTBarResponse represents the response body for the "ReleaseTBar" request. +Release the T-Bar (like a user releasing their mouse button after moving it). +*YOU MUST CALL THIS if you called `SetTBarPosition` with the `release` parameter set to `false`.* +Since v4.9.0. +*/ +type ReleaseTBarResponse struct { + requests.ResponseBasic +} + +// ReleaseTBar sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) ReleaseTBar(paramss ...*ReleaseTBarParams) (*ReleaseTBarResponse, error) { + if len(paramss) == 0 { + paramss = []*ReleaseTBarParams{{}} + } + params := paramss[0] + data := &ReleaseTBarResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.setcurrenttransition.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.setcurrenttransition.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetCurrentTransitionParams represents the params body for the "SetCurrentTransition" request. +Set the active transition. +Since 0.3. +*/ +type SetCurrentTransitionParams struct { + requests.ParamsBasic + + // The name of the transition. + TransitionName string `json:"transition-name,omitempty"` +} + +// GetSelfName just returns "SetCurrentTransition". +func (o *SetCurrentTransitionParams) GetSelfName() string { + return "SetCurrentTransition" +} + +/* +SetCurrentTransitionResponse represents the response body for the "SetCurrentTransition" request. +Set the active transition. +Since v0.3. +*/ +type SetCurrentTransitionResponse struct { + requests.ResponseBasic +} + +// SetCurrentTransition sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetCurrentTransition(params *SetCurrentTransitionParams) (*SetCurrentTransitionResponse, error) { + data := &SetCurrentTransitionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settbarposition.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settbarposition.go @@ -0,0 +1,49 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetTBarPositionParams represents the params body for the "SetTBarPosition" request. +Set the manual position of the T-Bar (in Studio Mode) to the specified value. Will return an error if OBS is not in studio mode or if the current transition doesn't support T-Bar control. + +If your code needs to perform multiple successive T-Bar moves (e.g. : in an animation, or in response to a user moving a T-Bar control in your User Interface), set `release` to false and call `ReleaseTBar` later once the animation/interaction is over. +Since 4.9.0. +*/ +type SetTBarPositionParams struct { + requests.ParamsBasic + + // T-Bar position. This value must be between 0.0 and 1.0. + Position float64 `json:"position,omitempty"` + + // Whether or not the T-Bar gets released automatically after setting its new position (like a user releasing their + // mouse button after moving the T-Bar). Call `ReleaseTBar` manually if you set `release` to false. Defaults to + // true. + Release bool `json:"release"` +} + +// GetSelfName just returns "SetTBarPosition". +func (o *SetTBarPositionParams) GetSelfName() string { + return "SetTBarPosition" +} + +/* +SetTBarPositionResponse represents the response body for the "SetTBarPosition" request. +Set the manual position of the T-Bar (in Studio Mode) to the specified value. Will return an error if OBS is not in studio mode or if the current transition doesn't support T-Bar control. + +If your code needs to perform multiple successive T-Bar moves (e.g. : in an animation, or in response to a user moving a T-Bar control in your User Interface), set `release` to false and call `ReleaseTBar` later once the animation/interaction is over. +Since v4.9.0. +*/ +type SetTBarPositionResponse struct { + requests.ResponseBasic +} + +// SetTBarPosition sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTBarPosition(params *SetTBarPositionParams) (*SetTBarPositionResponse, error) { + data := &SetTBarPositionResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionduration.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionduration.go @@ -0,0 +1,40 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetTransitionDurationParams represents the params body for the "SetTransitionDuration" request. +Set the duration of the currently selected transition if supported. +Since 4.0.0. +*/ +type SetTransitionDurationParams struct { + requests.ParamsBasic + + // Desired duration of the transition (in milliseconds). + Duration int `json:"duration,omitempty"` +} + +// GetSelfName just returns "SetTransitionDuration". +func (o *SetTransitionDurationParams) GetSelfName() string { + return "SetTransitionDuration" +} + +/* +SetTransitionDurationResponse represents the response body for the "SetTransitionDuration" request. +Set the duration of the currently selected transition if supported. +Since v4.0.0. +*/ +type SetTransitionDurationResponse struct { + requests.ResponseBasic +} + +// SetTransitionDuration sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTransitionDuration(params *SetTransitionDurationParams) (*SetTransitionDurationResponse, error) { + data := &SetTransitionDurationResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionsettings.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/xx_generated.settransitionsettings.go @@ -0,0 +1,46 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +SetTransitionSettingsParams represents the params body for the "SetTransitionSettings" request. +Change the current settings of a transition +Since 4.9.0. +*/ +type SetTransitionSettingsParams struct { + requests.ParamsBasic + + // Transition name + TransitionName string `json:"transitionName,omitempty"` + + // Transition settings (they can be partial) + TransitionSettings map[string]interface{} `json:"transitionSettings,omitempty"` +} + +// GetSelfName just returns "SetTransitionSettings". +func (o *SetTransitionSettingsParams) GetSelfName() string { + return "SetTransitionSettings" +} + +/* +SetTransitionSettingsResponse represents the response body for the "SetTransitionSettings" request. +Change the current settings of a transition +Since v4.9.0. +*/ +type SetTransitionSettingsResponse struct { + requests.ResponseBasic + + // Updated transition settings + TransitionSettings map[string]interface{} `json:"transitionSettings,omitempty"` +} + +// SetTransitionSettings sends the corresponding request to the connected OBS WebSockets server. +func (c *Client) SetTransitionSettings(params *SetTransitionSettingsParams) (*SetTransitionSettingsResponse, error) { + data := &SetTransitionSettingsResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/transitions/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/transitions/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package transitions + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'transitions' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.getvirtualcamstatus.go b/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.getvirtualcamstatus.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package virtualcam + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +GetVirtualCamStatusParams represents the params body for the "GetVirtualCamStatus" request. +Get current virtual cam status. +Since 4.9.1. +*/ +type GetVirtualCamStatusParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "GetVirtualCamStatus". +func (o *GetVirtualCamStatusParams) GetSelfName() string { + return "GetVirtualCamStatus" +} + +/* +GetVirtualCamStatusResponse represents the response body for the "GetVirtualCamStatus" request. +Get current virtual cam status. +Since v4.9.1. +*/ +type GetVirtualCamStatusResponse struct { + requests.ResponseBasic + + // Current virtual camera status. + IsVirtualCam bool `json:"isVirtualCam"` + + // Time elapsed since virtual cam started (only present if virtual cam currently active). + VirtualCamTimecode string `json:"virtualCamTimecode,omitempty"` +} + +// GetVirtualCamStatus sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) GetVirtualCamStatus(paramss ...*GetVirtualCamStatusParams) (*GetVirtualCamStatusResponse, error) { + if len(paramss) == 0 { + paramss = []*GetVirtualCamStatusParams{{}} + } + params := paramss[0] + data := &GetVirtualCamStatusResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startstopvirtualcam.go b/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startstopvirtualcam.go @@ -0,0 +1,42 @@ +// This file has been automatically generated. Don't edit it. + +package virtualcam + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartStopVirtualCamParams represents the params body for the "StartStopVirtualCam" request. +Toggle virtual cam on or off (depending on the current virtual cam state). +Since 4.9.1. +*/ +type StartStopVirtualCamParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartStopVirtualCam". +func (o *StartStopVirtualCamParams) GetSelfName() string { + return "StartStopVirtualCam" +} + +/* +StartStopVirtualCamResponse represents the response body for the "StartStopVirtualCam" request. +Toggle virtual cam on or off (depending on the current virtual cam state). +Since v4.9.1. +*/ +type StartStopVirtualCamResponse struct { + requests.ResponseBasic +} + +// StartStopVirtualCam sends the corresponding request to the connected OBS WebSockets server. Note the variadic +// arguments as this request doesn't require any parameters. +func (c *Client) StartStopVirtualCam(paramss ...*StartStopVirtualCamParams) (*StartStopVirtualCamResponse, error) { + if len(paramss) == 0 { + paramss = []*StartStopVirtualCamParams{{}} + } + params := paramss[0] + data := &StartStopVirtualCamResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startvirtualcam.go b/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.startvirtualcam.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package virtualcam + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StartVirtualCamParams represents the params body for the "StartVirtualCam" request. +Start virtual cam. +Will return an `error` if virtual cam is already active. +Since 4.9.1. +*/ +type StartVirtualCamParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StartVirtualCam". +func (o *StartVirtualCamParams) GetSelfName() string { + return "StartVirtualCam" +} + +/* +StartVirtualCamResponse represents the response body for the "StartVirtualCam" request. +Start virtual cam. +Will return an `error` if virtual cam is already active. +Since v4.9.1. +*/ +type StartVirtualCamResponse struct { + requests.ResponseBasic +} + +// StartVirtualCam sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments +// as this request doesn't require any parameters. +func (c *Client) StartVirtualCam(paramss ...*StartVirtualCamParams) (*StartVirtualCamResponse, error) { + if len(paramss) == 0 { + paramss = []*StartVirtualCamParams{{}} + } + params := paramss[0] + data := &StartVirtualCamResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.stopvirtualcam.go b/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/xx_generated.stopvirtualcam.go @@ -0,0 +1,44 @@ +// This file has been automatically generated. Don't edit it. + +package virtualcam + +import requests "github.com/andreykaipov/goobs/api/requests" + +/* +StopVirtualCamParams represents the params body for the "StopVirtualCam" request. +Stop virtual cam. +Will return an `error` if virtual cam is not active. +Since 4.9.1. +*/ +type StopVirtualCamParams struct { + requests.ParamsBasic +} + +// GetSelfName just returns "StopVirtualCam". +func (o *StopVirtualCamParams) GetSelfName() string { + return "StopVirtualCam" +} + +/* +StopVirtualCamResponse represents the response body for the "StopVirtualCam" request. +Stop virtual cam. +Will return an `error` if virtual cam is not active. +Since v4.9.1. +*/ +type StopVirtualCamResponse struct { + requests.ResponseBasic +} + +// StopVirtualCam sends the corresponding request to the connected OBS WebSockets server. Note the variadic arguments as +// this request doesn't require any parameters. +func (c *Client) StopVirtualCam(paramss ...*StopVirtualCamParams) (*StopVirtualCamResponse, error) { + if len(paramss) == 0 { + paramss = []*StopVirtualCamParams{{}} + } + params := paramss[0] + data := &StopVirtualCamResponse{} + if err := c.SendRequest(params, data); err != nil { + return nil, err + } + return data, nil +} diff --git a/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/api/requests/virtual_cam/zz_generated.client.go @@ -0,0 +1,10 @@ +// This file has been automatically generated. Don't edit it. + +package virtualcam + +import requests "github.com/andreykaipov/goobs/api/requests" + +// Client represents a client for 'virtual cam' requests +type Client struct { + *requests.Client +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/00_godoc.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/00_godoc.go @@ -0,0 +1,12 @@ +// Package typedefs defines both generated structs as specified under the +// [Typedefs +// section](https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#typedefs) +// of the protocol, and also manually defined "common" structs used across +// several events and requests. +// +// For example, `Crop` is used across: +// +// request - GetSceneItemProperties +// request - SetSceneItemProperties +// typedef - SceneItemTransform +package typedefs diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/bounds.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/bounds.go @@ -0,0 +1,19 @@ +package typedefs + +// Bounds defines a bounding box. +type Bounds struct { + // Alignment of the bounding box. + Alignment int `json:"alignment,omitempty"` + + // Type of bounding box. Can be "OBS_BOUNDS_STRETCH", + // "OBS_BOUNDS_SCALE_INNER", "OBS_BOUNDS_SCALE_OUTER", + // "OBS_BOUNDS_SCALE_TO_WIDTH", "OBS_BOUNDS_SCALE_TO_HEIGHT", + // "OBS_BOUNDS_MAX_ONLY" or "OBS_BOUNDS_NONE". + Type string `json:"type,omitempty"` + + // Width of the bounding box. + X float64 `json:"x,omitempty"` + + // Height of the bounding box. + Y float64 `json:"y,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/crop.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/crop.go @@ -0,0 +1,20 @@ +package typedefs + +// Crop defines a crop specification. +type Crop struct { + // The number of pixels cropped off the bottom of the object before + // scaling. + Bottom int `json:"bottom,omitempty"` + + // The number of pixels cropped off the left of the object before + // scaling. + Left int `json:"left,omitempty"` + + // The number of pixels cropped off the right of the object before + // scaling. + Right int `json:"right,omitempty"` + + // The number of pixels cropped off the top of the object before + // scaling. + Top int `json:"top,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/filter.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/filter.go @@ -0,0 +1,16 @@ +package typedefs + +// Filter specifies a filter. +type Filter struct { + // Filter status (enabled or not) + Enabled bool `json:"enabled"` + + // Filter name + Name string `json:"name,omitempty"` + + // Filter settings + Settings map[string]interface{} `json:"settings,omitempty"` + + // Filter type + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/font.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/font.go @@ -0,0 +1,17 @@ +package typedefs + +// Font specifies the font for Text-specific requests. +type Font struct { + // Font face. + Face string `json:"face,omitempty"` + + // Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, + // Underline=5, Strikeout=8` + Flags int `json:"flags,omitempty"` + + // Font text size. + Size int `json:"size,omitempty"` + + // Font Style (unknown function). + Style string `json:"style,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/item.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/item.go @@ -0,0 +1,8 @@ +package typedefs + +// Item represents an item among several requests in the scene items category. +type Item struct { + Id int `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/position.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/position.go @@ -0,0 +1,15 @@ +package typedefs + +// Position defines a position specification. +type Position struct { + // The point on the object that the item is manipulated from. The sum of + // 1=Left or 2=Right, and 4=Top or 8=Bottom, or omit to center on that + // axis. + Alignment int `json:"alignment,omitempty"` + + // The x position of the obejct from the left. + X float64 `json:"x,omitempty"` + + // The y position of the object from the top. + Y float64 `json:"y,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/scale.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/scale.go @@ -0,0 +1,15 @@ +package typedefs + +// Scale defines a scale specification. +type Scale struct { + // The scale filter of the source. Can be "OBS_SCALE_DISABLE", + // "OBS_SCALE_POINT", "OBS_SCALE_BICUBIC", "OBS_SCALE_BILINEAR", + // "OBS_SCALE_LANCZOS" or "OBS_SCALE_AREA". + Filter string `json:"filter,omitempty"` + + // The x-scale factor of the object. + X float64 `json:"x,omitempty"` + + // The y-scale factor of the object. + Y float64 `json:"y,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/stream_settings.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/stream_settings.go @@ -0,0 +1,22 @@ +package typedefs + +// StreamSettings specifies the stream settings. +type StreamSettings struct { + // The publish key of the stream. + Key string `json:"key,omitempty"` + + // The password to use when accessing the streaming server. Only + // relevant if `use_auth` is `true`. + Password string `json:"password,omitempty"` + + // The publish URL. + Server string `json:"server,omitempty"` + + // Indicates whether authentication should be used when connecting to + // the streaming server. + UseAuth bool `json:"use_auth"` + + // The username to use when accessing the streaming server. Only + // relevant if `use_auth` is `true`. + Username string `json:"username,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.obsstats.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.obsstats.go @@ -0,0 +1,33 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// OBSStats represents the complex type for OBSStats. +type OBSStats struct { + // Average frame render time (in milliseconds) + AverageFrameTime float64 `json:"average-frame-time,omitempty"` + + // Current CPU usage (percentage) + CpuUsage float64 `json:"cpu-usage,omitempty"` + + // Current framerate. + Fps float64 `json:"fps,omitempty"` + + // Free recording disk space (in megabytes) + FreeDiskSpace float64 `json:"free-disk-space,omitempty"` + + // Current RAM usage (in megabytes) + MemoryUsage float64 `json:"memory-usage,omitempty"` + + // Number of frames skipped due to encoding lag + OutputSkippedFrames int `json:"output-skipped-frames,omitempty"` + + // Number of frames outputted + OutputTotalFrames int `json:"output-total-frames,omitempty"` + + // Number of frames missed due to rendering lag + RenderMissedFrames int `json:"render-missed-frames,omitempty"` + + // Number of frames rendered + RenderTotalFrames int `json:"render-total-frames,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.output.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.output.go @@ -0,0 +1,61 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// Output represents the complex type for Output. +type Output struct { + // Output status (active or not) + Active bool `json:"active"` + + // Output congestion + Congestion float64 `json:"congestion,omitempty"` + + // Number of frames dropped + DroppedFrames int `json:"droppedFrames,omitempty"` + + Flags *Flags `json:"flags,omitempty"` + + // Video output height + Height int `json:"height,omitempty"` + + // Output name + Name string `json:"name,omitempty"` + + // Output reconnection status (reconnecting or not) + Reconnecting bool `json:"reconnecting"` + + // Output settings + Settings map[string]interface{} `json:"settings,omitempty"` + + // Total bytes sent + TotalBytes int `json:"totalBytes,omitempty"` + + // Number of frames sent + TotalFrames int `json:"totalFrames,omitempty"` + + // Output type/kind + Type string `json:"type,omitempty"` + + // Video output width + Width int `json:"width,omitempty"` +} + +type Flags struct { + // Output uses audio + Audio bool `json:"audio"` + + // Output is encoded + Encoded bool `json:"encoded"` + + // Output uses several audio tracks + MultiTrack bool `json:"multiTrack"` + + // Raw flags value + RawValue int `json:"rawValue,omitempty"` + + // Output uses a service + Service bool `json:"service"` + + // Output uses video + Video bool `json:"video"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scene.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scene.go @@ -0,0 +1,12 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// Scene represents the complex type for Scene. +type Scene struct { + // Name of the currently active scene. + Name string `json:"name,omitempty"` + + // Ordered list of the current scene's source items. + Sources []SceneItem `json:"sources,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitem.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitem.go @@ -0,0 +1,48 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// SceneItem represents the complex type for SceneItem. +type SceneItem struct { + // The point on the source that the item is manipulated from. The sum of 1=Left or 2=Right, and 4=Top or 8=Bottom, + // or omit to center on that axis. + Alignment float64 `json:"alignment,omitempty"` + + Cx float64 `json:"cx,omitempty"` + + Cy float64 `json:"cy,omitempty"` + + // List of children (if this item is a group) + GroupChildren []SceneItem `json:"groupChildren,omitempty"` + + // Scene item ID + Id int `json:"id,omitempty"` + + // Whether or not this Scene Item is locked and can't be moved around + Locked bool `json:"locked"` + + // Whether or not this Scene Item is muted. + Muted bool `json:"muted"` + + // The name of this Scene Item. + Name string `json:"name,omitempty"` + + // Name of the item's parent (if this item belongs to a group) + ParentGroupName string `json:"parentGroupName,omitempty"` + + // Whether or not this Scene Item is set to "visible". + Render bool `json:"render"` + + SourceCx float64 `json:"source_cx,omitempty"` + + SourceCy float64 `json:"source_cy,omitempty"` + + // Source type. Value is one of the following: "input", "filter", "transition", "scene" or "unknown" + Type string `json:"type,omitempty"` + + Volume float64 `json:"volume,omitempty"` + + X float64 `json:"x,omitempty"` + + Y float64 `json:"y,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitemtransform.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.sceneitemtransform.go @@ -0,0 +1,45 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// SceneItemTransform represents the complex type for SceneItemTransform. +type SceneItemTransform struct { + // The bounding box of the object (source, scene item, etc). + Bounds *Bounds `json:"bounds,omitempty"` + + // The crop specification for the object (source, scene item, etc). + Crop *Crop `json:"crop,omitempty"` + + // List of children (if this item is a group) + GroupChildren []SceneItemTransform `json:"groupChildren,omitempty"` + + // Scene item height (base source height multiplied by the vertical scaling factor) + Height float64 `json:"height,omitempty"` + + // If the scene item is locked in position. + Locked bool `json:"locked"` + + // Name of the item's parent (if this item belongs to a group) + ParentGroupName string `json:"parentGroupName,omitempty"` + + // The position of the object (source, scene item, etc). + Position *Position `json:"position,omitempty"` + + // The clockwise rotation of the scene item in degrees around the point of alignment. + Rotation float64 `json:"rotation,omitempty"` + + // The scaling specification for the object (source, scene item, etc). + Scale *Scale `json:"scale,omitempty"` + + // Base source (without scaling) of the source + SourceHeight int `json:"sourceHeight,omitempty"` + + // Base width (without scaling) of the source + SourceWidth int `json:"sourceWidth,omitempty"` + + // If the scene item is visible. + Visible bool `json:"visible"` + + // Scene item width (base source width multiplied by the horizontal scaling factor) + Width float64 `json:"width,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scenescollection.go b/vendor/github.com/andreykaipov/goobs/api/typedefs/xx_generated.scenescollection.go @@ -0,0 +1,9 @@ +// This file has been automatically generated. Don't edit it. + +package typedefs + +// ScenesCollection represents the complex type for ScenesCollection. +type ScenesCollection struct { + // Name of the scene collection + ScName string `json:"sc-name,omitempty"` +} diff --git a/vendor/github.com/andreykaipov/goobs/client.go b/vendor/github.com/andreykaipov/goobs/client.go @@ -0,0 +1,182 @@ +package goobs + +import ( + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "net/url" + + "github.com/andreykaipov/goobs/api/events" + "github.com/andreykaipov/goobs/api/requests" + general "github.com/andreykaipov/goobs/api/requests/general" + "github.com/gorilla/websocket" +) + +// Client represents a client to an OBS websockets server. +type Client struct { + // IncomingEvents is used to read events from OBS. For example, + // + // ```go + // for event := range client.IncomingEvents { + // switch e := event.(type) { + // case *events.SomeEventA: + // ... + // case *events.SomeEventB: + // ... + // default: + // } + // } + // ``` + IncomingEvents chan events.Event + + *requests.Client + subclients + + host string + password string +} + +// Option represents a functional option of a Client. +type Option func(*Client) + +// WithPassword sets the password of a client. +func WithPassword(x string) Option { + return func(o *Client) { + o.password = x + } +} + +/* +New creates and configures a client to interact with the OBS websockets server. +It also opens up a connection, so be sure to check the error. +*/ +func New(host string, opts ...Option) (*Client, error) { + c := &Client{ + Client: &requests.Client{}, + host: host, + } + + for _, opt := range opts { + opt(c) + } + + if err := c.connect(); err != nil { + return nil, err + } + + setClients(c) + + c.IncomingEvents = make(chan events.Event, 100) + c.IncomingResponses = make(chan json.RawMessage, 100) + go c.handleMessages() + + if err := c.authenticate(); err != nil { + return nil, err + } + + return c, nil +} + +func (c *Client) connect() (err error) { + u := url.URL{Scheme: "ws", Host: c.host} + + // log.Printf("connecting to %s", u.String()) + if c.Conn, _, err = websocket.DefaultDialer.Dial(u.String(), nil); err != nil { + return err + } + + return nil +} + +// Pretty much the pseudo-code from +// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#authentication +func (c *Client) authenticate() error { + authReqResp, err := c.General.GetAuthRequired() + if err != nil { + return fmt.Errorf("Failed getting auth: %s", err) + } + + if !authReqResp.AuthRequired { + return nil + } + + hash := sha256.Sum256([]byte(c.password + authReqResp.Salt)) + secret := base64.StdEncoding.EncodeToString(hash[:]) + + authHash := sha256.Sum256([]byte(secret + authReqResp.Challenge)) + authSecret := base64.StdEncoding.EncodeToString(authHash[:]) + + if _, err := c.General.Authenticate(&general.AuthenticateParams{ + Auth: authSecret, + }); err != nil { + return fmt.Errorf("Failed authenticating: %s", err) + } + + return nil +} + +func (c *Client) handleMessages() { + messages := make(chan json.RawMessage) + errors := make(chan error) + go c.handleErrors(errors) + go c.handleConnection(messages, errors) + c.handleRawMessages(messages, errors) +} + +// Expose eventing errors as... more events +func (c *Client) handleErrors(errors chan error) { + for err := range errors { + c.IncomingEvents <- events.WrapError(err) + } +} + +func (c *Client) handleConnection(messages chan json.RawMessage, errors chan error) { + for { + msg := json.RawMessage{} + if err := c.Conn.ReadJSON(&msg); err != nil { + errors <- fmt.Errorf("Couldn't read JSON from websocket connection: %s", err) + continue + } + + messages <- msg + } +} + +func (c *Client) handleRawMessages(messages chan json.RawMessage, errors chan error) { + for raw := range messages { + // Parse into a generic map to figure out if it's an event or + // a response to a request first. Then act accordingly. + checked := map[string]interface{}{} + if err := json.Unmarshal(raw, &checked); err != nil { + errors <- fmt.Errorf("Couldn't unmarshal message: %s", err) + continue + } + + // Responses are parsed when the request is sent + if _, ok := checked["message-id"]; ok { + c.IncomingResponses <- raw + continue + } + + // Events are parsed immediately. Kinda wasteful to do since + // they might not ever be read, but it's not the end of the + // world. Could always add an explicit option to enable events! + if _, ok := checked["update-type"]; ok { + event, err := events.Parse(raw) + if err != nil { + errors <- fmt.Errorf("Couldn't parse raw event: %s", err) + continue + } + + select { + case c.IncomingEvents <- event: + default: + } + + continue + } + + panic("idk what kinda message this is lol") + } +} diff --git a/vendor/github.com/andreykaipov/goobs/go.mod b/vendor/github.com/andreykaipov/goobs/go.mod @@ -0,0 +1,8 @@ +module github.com/andreykaipov/goobs + +go 1.16 + +require ( + github.com/gorilla/websocket v1.4.2 + github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d +) diff --git a/vendor/github.com/andreykaipov/goobs/go.sum b/vendor/github.com/andreykaipov/goobs/go.sum @@ -0,0 +1,4 @@ +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= diff --git a/vendor/github.com/andreykaipov/goobs/zz_generated.client.go b/vendor/github.com/andreykaipov/goobs/zz_generated.client.go @@ -0,0 +1,54 @@ +// This file has been automatically generated. Don't edit it. + +package goobs + +import ( + general "github.com/andreykaipov/goobs/api/requests/general" + mediacontrol "github.com/andreykaipov/goobs/api/requests/media_control" + outputs "github.com/andreykaipov/goobs/api/requests/outputs" + profiles "github.com/andreykaipov/goobs/api/requests/profiles" + recording "github.com/andreykaipov/goobs/api/requests/recording" + replaybuffer "github.com/andreykaipov/goobs/api/requests/replay_buffer" + scenecollections "github.com/andreykaipov/goobs/api/requests/scene_collections" + sceneitems "github.com/andreykaipov/goobs/api/requests/scene_items" + scenes "github.com/andreykaipov/goobs/api/requests/scenes" + sources "github.com/andreykaipov/goobs/api/requests/sources" + streaming "github.com/andreykaipov/goobs/api/requests/streaming" + studiomode "github.com/andreykaipov/goobs/api/requests/studio_mode" + transitions "github.com/andreykaipov/goobs/api/requests/transitions" + virtualcam "github.com/andreykaipov/goobs/api/requests/virtual_cam" +) + +type subclients struct { + General *general.Client + MediaControl *mediacontrol.Client + Outputs *outputs.Client + Profiles *profiles.Client + Recording *recording.Client + ReplayBuffer *replaybuffer.Client + SceneCollections *scenecollections.Client + SceneItems *sceneitems.Client + Scenes *scenes.Client + Sources *sources.Client + Streaming *streaming.Client + StudioMode *studiomode.Client + Transitions *transitions.Client + VirtualCam *virtualcam.Client +} + +func setClients(c *Client) { + c.General = &general.Client{Client: c.Client} + c.MediaControl = &mediacontrol.Client{Client: c.Client} + c.Outputs = &outputs.Client{Client: c.Client} + c.Profiles = &profiles.Client{Client: c.Client} + c.Recording = &recording.Client{Client: c.Client} + c.ReplayBuffer = &replaybuffer.Client{Client: c.Client} + c.SceneCollections = &scenecollections.Client{Client: c.Client} + c.SceneItems = &sceneitems.Client{Client: c.Client} + c.Scenes = &scenes.Client{Client: c.Client} + c.Sources = &sources.Client{Client: c.Client} + c.Streaming = &streaming.Client{Client: c.Client} + c.StudioMode = &studiomode.Client{Client: c.Client} + c.Transitions = &transitions.Client{Client: c.Client} + c.VirtualCam = &virtualcam.Client{Client: c.Client} +} diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +.idea/ +*.iml diff --git a/vendor/github.com/gorilla/websocket/AUTHORS b/vendor/github.com/gorilla/websocket/AUTHORS @@ -0,0 +1,9 @@ +# This is the official list of Gorilla WebSocket authors for copyright +# purposes. +# +# Please keep the list sorted. + +Gary Burd <[email protected]> +Google LLC (https://opensource.google.com/) +Joachim Bauch <[email protected]> + diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md @@ -0,0 +1,64 @@ +# Gorilla WebSocket + +[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) +[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket) + +Gorilla WebSocket is a [Go](http://golang.org/) implementation of the +[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. + +### Documentation + +* [API Reference](https://pkg.go.dev/github.com/gorilla/websocket?tab=doc) +* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat) +* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) +* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) +* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch) + +### Status + +The Gorilla WebSocket package provides a complete and tested implementation of +the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The +package API is stable. + +### Installation + + go get github.com/gorilla/websocket + +### Protocol Compliance + +The Gorilla WebSocket package passes the server tests in the [Autobahn Test +Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn +subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). + +### Gorilla WebSocket compared with other packages + +<table> +<tr> +<th></th> +<th><a href="http://godoc.org/github.com/gorilla/websocket">github.com/gorilla</a></th> +<th><a href="http://godoc.org/golang.org/x/net/websocket">golang.org/x/net</a></th> +</tr> +<tr> +<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr> +<tr><td>Passes <a href="https://github.com/crossbario/autobahn-testsuite">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr> +<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr> +<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr> +<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr> +<tr><td>Get the <a href="https://tools.ietf.org/html/rfc6455#section-5.6">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr> +<tr><td colspan="3">Other Features</tr></td> +<tr><td><a href="https://tools.ietf.org/html/rfc7692">Compression Extensions</a></td><td>Experimental</td><td>No</td></tr> +<tr><td>Read message using io.Reader</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextReader">Yes</a></td><td>No, see note 3</td></tr> +<tr><td>Write message using io.WriteCloser</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter">Yes</a></td><td>No, see note 3</td></tr> +</table> + +Notes: + +1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html). +2. The application can get the type of a received data message by implementing + a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal) + function. +3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries. + Read returns when the input buffer is full or a frame boundary is + encountered. Each call to Write sends a single frame message. The Gorilla + io.Reader and io.WriteCloser operate on a single WebSocket message. + diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go @@ -0,0 +1,395 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "bytes" + "context" + "crypto/tls" + "errors" + "io" + "io/ioutil" + "net" + "net/http" + "net/http/httptrace" + "net/url" + "strings" + "time" +) + +// ErrBadHandshake is returned when the server response to opening handshake is +// invalid. +var ErrBadHandshake = errors.New("websocket: bad handshake") + +var errInvalidCompression = errors.New("websocket: invalid compression negotiation") + +// NewClient creates a new client connection using the given net connection. +// The URL u specifies the host and request URI. Use requestHeader to specify +// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies +// (Cookie). Use the response.Header to get the selected subprotocol +// (Sec-WebSocket-Protocol) and cookies (Set-Cookie). +// +// If the WebSocket handshake fails, ErrBadHandshake is returned along with a +// non-nil *http.Response so that callers can handle redirects, authentication, +// etc. +// +// Deprecated: Use Dialer instead. +func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) { + d := Dialer{ + ReadBufferSize: readBufSize, + WriteBufferSize: writeBufSize, + NetDial: func(net, addr string) (net.Conn, error) { + return netConn, nil + }, + } + return d.Dial(u.String(), requestHeader) +} + +// A Dialer contains options for connecting to WebSocket server. +type Dialer struct { + // NetDial specifies the dial function for creating TCP connections. If + // NetDial is nil, net.Dial is used. + NetDial func(network, addr string) (net.Conn, error) + + // NetDialContext specifies the dial function for creating TCP connections. If + // NetDialContext is nil, net.DialContext is used. + NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) + + // Proxy specifies a function to return a proxy for a given + // Request. If the function returns a non-nil error, the + // request is aborted with the provided error. + // If Proxy is nil or returns a nil *URL, no proxy is used. + Proxy func(*http.Request) (*url.URL, error) + + // TLSClientConfig specifies the TLS configuration to use with tls.Client. + // If nil, the default configuration is used. + TLSClientConfig *tls.Config + + // HandshakeTimeout specifies the duration for the handshake to complete. + HandshakeTimeout time.Duration + + // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer + // size is zero, then a useful default size is used. The I/O buffer sizes + // do not limit the size of the messages that can be sent or received. + ReadBufferSize, WriteBufferSize int + + // WriteBufferPool is a pool of buffers for write operations. If the value + // is not set, then write buffers are allocated to the connection for the + // lifetime of the connection. + // + // A pool is most useful when the application has a modest volume of writes + // across a large number of connections. + // + // Applications should use a single pool for each unique value of + // WriteBufferSize. + WriteBufferPool BufferPool + + // Subprotocols specifies the client's requested subprotocols. + Subprotocols []string + + // EnableCompression specifies if the client should attempt to negotiate + // per message compression (RFC 7692). Setting this value to true does not + // guarantee that compression will be supported. Currently only "no context + // takeover" modes are supported. + EnableCompression bool + + // Jar specifies the cookie jar. + // If Jar is nil, cookies are not sent in requests and ignored + // in responses. + Jar http.CookieJar +} + +// Dial creates a new client connection by calling DialContext with a background context. +func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { + return d.DialContext(context.Background(), urlStr, requestHeader) +} + +var errMalformedURL = errors.New("malformed ws or wss URL") + +func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { + hostPort = u.Host + hostNoPort = u.Host + if i := strings.LastIndex(u.Host, ":"); i > strings.LastIndex(u.Host, "]") { + hostNoPort = hostNoPort[:i] + } else { + switch u.Scheme { + case "wss": + hostPort += ":443" + case "https": + hostPort += ":443" + default: + hostPort += ":80" + } + } + return hostPort, hostNoPort +} + +// DefaultDialer is a dialer with all fields set to the default values. +var DefaultDialer = &Dialer{ + Proxy: http.ProxyFromEnvironment, + HandshakeTimeout: 45 * time.Second, +} + +// nilDialer is dialer to use when receiver is nil. +var nilDialer = *DefaultDialer + +// DialContext creates a new client connection. Use requestHeader to specify the +// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). +// Use the response.Header to get the selected subprotocol +// (Sec-WebSocket-Protocol) and cookies (Set-Cookie). +// +// The context will be used in the request and in the Dialer. +// +// If the WebSocket handshake fails, ErrBadHandshake is returned along with a +// non-nil *http.Response so that callers can handle redirects, authentication, +// etcetera. The response body may not contain the entire response and does not +// need to be closed by the application. +func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { + if d == nil { + d = &nilDialer + } + + challengeKey, err := generateChallengeKey() + if err != nil { + return nil, nil, err + } + + u, err := url.Parse(urlStr) + if err != nil { + return nil, nil, err + } + + switch u.Scheme { + case "ws": + u.Scheme = "http" + case "wss": + u.Scheme = "https" + default: + return nil, nil, errMalformedURL + } + + if u.User != nil { + // User name and password are not allowed in websocket URIs. + return nil, nil, errMalformedURL + } + + req := &http.Request{ + Method: "GET", + URL: u, + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + Host: u.Host, + } + req = req.WithContext(ctx) + + // Set the cookies present in the cookie jar of the dialer + if d.Jar != nil { + for _, cookie := range d.Jar.Cookies(u) { + req.AddCookie(cookie) + } + } + + // Set the request headers using the capitalization for names and values in + // RFC examples. Although the capitalization shouldn't matter, there are + // servers that depend on it. The Header.Set method is not used because the + // method canonicalizes the header names. + req.Header["Upgrade"] = []string{"websocket"} + req.Header["Connection"] = []string{"Upgrade"} + req.Header["Sec-WebSocket-Key"] = []string{challengeKey} + req.Header["Sec-WebSocket-Version"] = []string{"13"} + if len(d.Subprotocols) > 0 { + req.Header["Sec-WebSocket-Protocol"] = []string{strings.Join(d.Subprotocols, ", ")} + } + for k, vs := range requestHeader { + switch { + case k == "Host": + if len(vs) > 0 { + req.Host = vs[0] + } + case k == "Upgrade" || + k == "Connection" || + k == "Sec-Websocket-Key" || + k == "Sec-Websocket-Version" || + k == "Sec-Websocket-Extensions" || + (k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0): + return nil, nil, errors.New("websocket: duplicate header not allowed: " + k) + case k == "Sec-Websocket-Protocol": + req.Header["Sec-WebSocket-Protocol"] = vs + default: + req.Header[k] = vs + } + } + + if d.EnableCompression { + req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"} + } + + if d.HandshakeTimeout != 0 { + var cancel func() + ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout) + defer cancel() + } + + // Get network dial function. + var netDial func(network, add string) (net.Conn, error) + + if d.NetDialContext != nil { + netDial = func(network, addr string) (net.Conn, error) { + return d.NetDialContext(ctx, network, addr) + } + } else if d.NetDial != nil { + netDial = d.NetDial + } else { + netDialer := &net.Dialer{} + netDial = func(network, addr string) (net.Conn, error) { + return netDialer.DialContext(ctx, network, addr) + } + } + + // If needed, wrap the dial function to set the connection deadline. + if deadline, ok := ctx.Deadline(); ok { + forwardDial := netDial + netDial = func(network, addr string) (net.Conn, error) { + c, err := forwardDial(network, addr) + if err != nil { + return nil, err + } + err = c.SetDeadline(deadline) + if err != nil { + c.Close() + return nil, err + } + return c, nil + } + } + + // If needed, wrap the dial function to connect through a proxy. + if d.Proxy != nil { + proxyURL, err := d.Proxy(req) + if err != nil { + return nil, nil, err + } + if proxyURL != nil { + dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial)) + if err != nil { + return nil, nil, err + } + netDial = dialer.Dial + } + } + + hostPort, hostNoPort := hostPortNoPort(u) + trace := httptrace.ContextClientTrace(ctx) + if trace != nil && trace.GetConn != nil { + trace.GetConn(hostPort) + } + + netConn, err := netDial("tcp", hostPort) + if trace != nil && trace.GotConn != nil { + trace.GotConn(httptrace.GotConnInfo{ + Conn: netConn, + }) + } + if err != nil { + return nil, nil, err + } + + defer func() { + if netConn != nil { + netConn.Close() + } + }() + + if u.Scheme == "https" { + cfg := cloneTLSConfig(d.TLSClientConfig) + if cfg.ServerName == "" { + cfg.ServerName = hostNoPort + } + tlsConn := tls.Client(netConn, cfg) + netConn = tlsConn + + var err error + if trace != nil { + err = doHandshakeWithTrace(trace, tlsConn, cfg) + } else { + err = doHandshake(tlsConn, cfg) + } + + if err != nil { + return nil, nil, err + } + } + + conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil) + + if err := req.Write(netConn); err != nil { + return nil, nil, err + } + + if trace != nil && trace.GotFirstResponseByte != nil { + if peek, err := conn.br.Peek(1); err == nil && len(peek) == 1 { + trace.GotFirstResponseByte() + } + } + + resp, err := http.ReadResponse(conn.br, req) + if err != nil { + return nil, nil, err + } + + if d.Jar != nil { + if rc := resp.Cookies(); len(rc) > 0 { + d.Jar.SetCookies(u, rc) + } + } + + if resp.StatusCode != 101 || + !strings.EqualFold(resp.Header.Get("Upgrade"), "websocket") || + !strings.EqualFold(resp.Header.Get("Connection"), "upgrade") || + resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) { + // Before closing the network connection on return from this + // function, slurp up some of the response to aid application + // debugging. + buf := make([]byte, 1024) + n, _ := io.ReadFull(resp.Body, buf) + resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n])) + return nil, resp, ErrBadHandshake + } + + for _, ext := range parseExtensions(resp.Header) { + if ext[""] != "permessage-deflate" { + continue + } + _, snct := ext["server_no_context_takeover"] + _, cnct := ext["client_no_context_takeover"] + if !snct || !cnct { + return nil, resp, errInvalidCompression + } + conn.newCompressionWriter = compressNoContextTakeover + conn.newDecompressionReader = decompressNoContextTakeover + break + } + + resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) + conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol") + + netConn.SetDeadline(time.Time{}) + netConn = nil // to avoid close in defer. + return conn, resp, nil +} + +func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error { + if err := tlsConn.Handshake(); err != nil { + return err + } + if !cfg.InsecureSkipVerify { + if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/gorilla/websocket/client_clone.go b/vendor/github.com/gorilla/websocket/client_clone.go @@ -0,0 +1,16 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.8 + +package websocket + +import "crypto/tls" + +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + return cfg.Clone() +} diff --git a/vendor/github.com/gorilla/websocket/client_clone_legacy.go b/vendor/github.com/gorilla/websocket/client_clone_legacy.go @@ -0,0 +1,38 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !go1.8 + +package websocket + +import "crypto/tls" + +// cloneTLSConfig clones all public fields except the fields +// SessionTicketsDisabled and SessionTicketKey. This avoids copying the +// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a +// config in active use. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + return &tls.Config{ + Rand: cfg.Rand, + Time: cfg.Time, + Certificates: cfg.Certificates, + NameToCertificate: cfg.NameToCertificate, + GetCertificate: cfg.GetCertificate, + RootCAs: cfg.RootCAs, + NextProtos: cfg.NextProtos, + ServerName: cfg.ServerName, + ClientAuth: cfg.ClientAuth, + ClientCAs: cfg.ClientCAs, + InsecureSkipVerify: cfg.InsecureSkipVerify, + CipherSuites: cfg.CipherSuites, + PreferServerCipherSuites: cfg.PreferServerCipherSuites, + ClientSessionCache: cfg.ClientSessionCache, + MinVersion: cfg.MinVersion, + MaxVersion: cfg.MaxVersion, + CurvePreferences: cfg.CurvePreferences, + } +} diff --git a/vendor/github.com/gorilla/websocket/compression.go b/vendor/github.com/gorilla/websocket/compression.go @@ -0,0 +1,148 @@ +// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "compress/flate" + "errors" + "io" + "strings" + "sync" +) + +const ( + minCompressionLevel = -2 // flate.HuffmanOnly not defined in Go < 1.6 + maxCompressionLevel = flate.BestCompression + defaultCompressionLevel = 1 +) + +var ( + flateWriterPools [maxCompressionLevel - minCompressionLevel + 1]sync.Pool + flateReaderPool = sync.Pool{New: func() interface{} { + return flate.NewReader(nil) + }} +) + +func decompressNoContextTakeover(r io.Reader) io.ReadCloser { + const tail = + // Add four bytes as specified in RFC + "\x00\x00\xff\xff" + + // Add final block to squelch unexpected EOF error from flate reader. + "\x01\x00\x00\xff\xff" + + fr, _ := flateReaderPool.Get().(io.ReadCloser) + fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil) + return &flateReadWrapper{fr} +} + +func isValidCompressionLevel(level int) bool { + return minCompressionLevel <= level && level <= maxCompressionLevel +} + +func compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser { + p := &flateWriterPools[level-minCompressionLevel] + tw := &truncWriter{w: w} + fw, _ := p.Get().(*flate.Writer) + if fw == nil { + fw, _ = flate.NewWriter(tw, level) + } else { + fw.Reset(tw) + } + return &flateWriteWrapper{fw: fw, tw: tw, p: p} +} + +// truncWriter is an io.Writer that writes all but the last four bytes of the +// stream to another io.Writer. +type truncWriter struct { + w io.WriteCloser + n int + p [4]byte +} + +func (w *truncWriter) Write(p []byte) (int, error) { + n := 0 + + // fill buffer first for simplicity. + if w.n < len(w.p) { + n = copy(w.p[w.n:], p) + p = p[n:] + w.n += n + if len(p) == 0 { + return n, nil + } + } + + m := len(p) + if m > len(w.p) { + m = len(w.p) + } + + if nn, err := w.w.Write(w.p[:m]); err != nil { + return n + nn, err + } + + copy(w.p[:], w.p[m:]) + copy(w.p[len(w.p)-m:], p[len(p)-m:]) + nn, err := w.w.Write(p[:len(p)-m]) + return n + nn, err +} + +type flateWriteWrapper struct { + fw *flate.Writer + tw *truncWriter + p *sync.Pool +} + +func (w *flateWriteWrapper) Write(p []byte) (int, error) { + if w.fw == nil { + return 0, errWriteClosed + } + return w.fw.Write(p) +} + +func (w *flateWriteWrapper) Close() error { + if w.fw == nil { + return errWriteClosed + } + err1 := w.fw.Flush() + w.p.Put(w.fw) + w.fw = nil + if w.tw.p != [4]byte{0, 0, 0xff, 0xff} { + return errors.New("websocket: internal error, unexpected bytes at end of flate stream") + } + err2 := w.tw.w.Close() + if err1 != nil { + return err1 + } + return err2 +} + +type flateReadWrapper struct { + fr io.ReadCloser +} + +func (r *flateReadWrapper) Read(p []byte) (int, error) { + if r.fr == nil { + return 0, io.ErrClosedPipe + } + n, err := r.fr.Read(p) + if err == io.EOF { + // Preemptively place the reader back in the pool. This helps with + // scenarios where the application does not call NextReader() soon after + // this final read. + r.Close() + } + return n, err +} + +func (r *flateReadWrapper) Close() error { + if r.fr == nil { + return io.ErrClosedPipe + } + err := r.fr.Close() + flateReaderPool.Put(r.fr) + r.fr = nil + return err +} diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go @@ -0,0 +1,1201 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "bufio" + "encoding/binary" + "errors" + "io" + "io/ioutil" + "math/rand" + "net" + "strconv" + "sync" + "time" + "unicode/utf8" +) + +const ( + // Frame header byte 0 bits from Section 5.2 of RFC 6455 + finalBit = 1 << 7 + rsv1Bit = 1 << 6 + rsv2Bit = 1 << 5 + rsv3Bit = 1 << 4 + + // Frame header byte 1 bits from Section 5.2 of RFC 6455 + maskBit = 1 << 7 + + maxFrameHeaderSize = 2 + 8 + 4 // Fixed header + length + mask + maxControlFramePayloadSize = 125 + + writeWait = time.Second + + defaultReadBufferSize = 4096 + defaultWriteBufferSize = 4096 + + continuationFrame = 0 + noFrame = -1 +) + +// Close codes defined in RFC 6455, section 11.7. +const ( + CloseNormalClosure = 1000 + CloseGoingAway = 1001 + CloseProtocolError = 1002 + CloseUnsupportedData = 1003 + CloseNoStatusReceived = 1005 + CloseAbnormalClosure = 1006 + CloseInvalidFramePayloadData = 1007 + ClosePolicyViolation = 1008 + CloseMessageTooBig = 1009 + CloseMandatoryExtension = 1010 + CloseInternalServerErr = 1011 + CloseServiceRestart = 1012 + CloseTryAgainLater = 1013 + CloseTLSHandshake = 1015 +) + +// The message types are defined in RFC 6455, section 11.8. +const ( + // TextMessage denotes a text data message. The text message payload is + // interpreted as UTF-8 encoded text data. + TextMessage = 1 + + // BinaryMessage denotes a binary data message. + BinaryMessage = 2 + + // CloseMessage denotes a close control message. The optional message + // payload contains a numeric code and text. Use the FormatCloseMessage + // function to format a close message payload. + CloseMessage = 8 + + // PingMessage denotes a ping control message. The optional message payload + // is UTF-8 encoded text. + PingMessage = 9 + + // PongMessage denotes a pong control message. The optional message payload + // is UTF-8 encoded text. + PongMessage = 10 +) + +// ErrCloseSent is returned when the application writes a message to the +// connection after sending a close message. +var ErrCloseSent = errors.New("websocket: close sent") + +// ErrReadLimit is returned when reading a message that is larger than the +// read limit set for the connection. +var ErrReadLimit = errors.New("websocket: read limit exceeded") + +// netError satisfies the net Error interface. +type netError struct { + msg string + temporary bool + timeout bool +} + +func (e *netError) Error() string { return e.msg } +func (e *netError) Temporary() bool { return e.temporary } +func (e *netError) Timeout() bool { return e.timeout } + +// CloseError represents a close message. +type CloseError struct { + // Code is defined in RFC 6455, section 11.7. + Code int + + // Text is the optional text payload. + Text string +} + +func (e *CloseError) Error() string { + s := []byte("websocket: close ") + s = strconv.AppendInt(s, int64(e.Code), 10) + switch e.Code { + case CloseNormalClosure: + s = append(s, " (normal)"...) + case CloseGoingAway: + s = append(s, " (going away)"...) + case CloseProtocolError: + s = append(s, " (protocol error)"...) + case CloseUnsupportedData: + s = append(s, " (unsupported data)"...) + case CloseNoStatusReceived: + s = append(s, " (no status)"...) + case CloseAbnormalClosure: + s = append(s, " (abnormal closure)"...) + case CloseInvalidFramePayloadData: + s = append(s, " (invalid payload data)"...) + case ClosePolicyViolation: + s = append(s, " (policy violation)"...) + case CloseMessageTooBig: + s = append(s, " (message too big)"...) + case CloseMandatoryExtension: + s = append(s, " (mandatory extension missing)"...) + case CloseInternalServerErr: + s = append(s, " (internal server error)"...) + case CloseTLSHandshake: + s = append(s, " (TLS handshake error)"...) + } + if e.Text != "" { + s = append(s, ": "...) + s = append(s, e.Text...) + } + return string(s) +} + +// IsCloseError returns boolean indicating whether the error is a *CloseError +// with one of the specified codes. +func IsCloseError(err error, codes ...int) bool { + if e, ok := err.(*CloseError); ok { + for _, code := range codes { + if e.Code == code { + return true + } + } + } + return false +} + +// IsUnexpectedCloseError returns boolean indicating whether the error is a +// *CloseError with a code not in the list of expected codes. +func IsUnexpectedCloseError(err error, expectedCodes ...int) bool { + if e, ok := err.(*CloseError); ok { + for _, code := range expectedCodes { + if e.Code == code { + return false + } + } + return true + } + return false +} + +var ( + errWriteTimeout = &netError{msg: "websocket: write timeout", timeout: true, temporary: true} + errUnexpectedEOF = &CloseError{Code: CloseAbnormalClosure, Text: io.ErrUnexpectedEOF.Error()} + errBadWriteOpCode = errors.New("websocket: bad write message type") + errWriteClosed = errors.New("websocket: write closed") + errInvalidControlFrame = errors.New("websocket: invalid control frame") +) + +func newMaskKey() [4]byte { + n := rand.Uint32() + return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)} +} + +func hideTempErr(err error) error { + if e, ok := err.(net.Error); ok && e.Temporary() { + err = &netError{msg: e.Error(), timeout: e.Timeout()} + } + return err +} + +func isControl(frameType int) bool { + return frameType == CloseMessage || frameType == PingMessage || frameType == PongMessage +} + +func isData(frameType int) bool { + return frameType == TextMessage || frameType == BinaryMessage +} + +var validReceivedCloseCodes = map[int]bool{ + // see http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number + + CloseNormalClosure: true, + CloseGoingAway: true, + CloseProtocolError: true, + CloseUnsupportedData: true, + CloseNoStatusReceived: false, + CloseAbnormalClosure: false, + CloseInvalidFramePayloadData: true, + ClosePolicyViolation: true, + CloseMessageTooBig: true, + CloseMandatoryExtension: true, + CloseInternalServerErr: true, + CloseServiceRestart: true, + CloseTryAgainLater: true, + CloseTLSHandshake: false, +} + +func isValidReceivedCloseCode(code int) bool { + return validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999) +} + +// BufferPool represents a pool of buffers. The *sync.Pool type satisfies this +// interface. The type of the value stored in a pool is not specified. +type BufferPool interface { + // Get gets a value from the pool or returns nil if the pool is empty. + Get() interface{} + // Put adds a value to the pool. + Put(interface{}) +} + +// writePoolData is the type added to the write buffer pool. This wrapper is +// used to prevent applications from peeking at and depending on the values +// added to the pool. +type writePoolData struct{ buf []byte } + +// The Conn type represents a WebSocket connection. +type Conn struct { + conn net.Conn + isServer bool + subprotocol string + + // Write fields + mu chan struct{} // used as mutex to protect write to conn + writeBuf []byte // frame is constructed in this buffer. + writePool BufferPool + writeBufSize int + writeDeadline time.Time + writer io.WriteCloser // the current writer returned to the application + isWriting bool // for best-effort concurrent write detection + + writeErrMu sync.Mutex + writeErr error + + enableWriteCompression bool + compressionLevel int + newCompressionWriter func(io.WriteCloser, int) io.WriteCloser + + // Read fields + reader io.ReadCloser // the current reader returned to the application + readErr error + br *bufio.Reader + // bytes remaining in current frame. + // set setReadRemaining to safely update this value and prevent overflow + readRemaining int64 + readFinal bool // true the current message has more frames. + readLength int64 // Message size. + readLimit int64 // Maximum message size. + readMaskPos int + readMaskKey [4]byte + handlePong func(string) error + handlePing func(string) error + handleClose func(int, string) error + readErrCount int + messageReader *messageReader // the current low-level reader + + readDecompress bool // whether last read frame had RSV1 set + newDecompressionReader func(io.Reader) io.ReadCloser +} + +func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, writeBufferPool BufferPool, br *bufio.Reader, writeBuf []byte) *Conn { + + if br == nil { + if readBufferSize == 0 { + readBufferSize = defaultReadBufferSize + } else if readBufferSize < maxControlFramePayloadSize { + // must be large enough for control frame + readBufferSize = maxControlFramePayloadSize + } + br = bufio.NewReaderSize(conn, readBufferSize) + } + + if writeBufferSize <= 0 { + writeBufferSize = defaultWriteBufferSize + } + writeBufferSize += maxFrameHeaderSize + + if writeBuf == nil && writeBufferPool == nil { + writeBuf = make([]byte, writeBufferSize) + } + + mu := make(chan struct{}, 1) + mu <- struct{}{} + c := &Conn{ + isServer: isServer, + br: br, + conn: conn, + mu: mu, + readFinal: true, + writeBuf: writeBuf, + writePool: writeBufferPool, + writeBufSize: writeBufferSize, + enableWriteCompression: true, + compressionLevel: defaultCompressionLevel, + } + c.SetCloseHandler(nil) + c.SetPingHandler(nil) + c.SetPongHandler(nil) + return c +} + +// setReadRemaining tracks the number of bytes remaining on the connection. If n +// overflows, an ErrReadLimit is returned. +func (c *Conn) setReadRemaining(n int64) error { + if n < 0 { + return ErrReadLimit + } + + c.readRemaining = n + return nil +} + +// Subprotocol returns the negotiated protocol for the connection. +func (c *Conn) Subprotocol() string { + return c.subprotocol +} + +// Close closes the underlying network connection without sending or waiting +// for a close message. +func (c *Conn) Close() error { + return c.conn.Close() +} + +// LocalAddr returns the local network address. +func (c *Conn) LocalAddr() net.Addr { + return c.conn.LocalAddr() +} + +// RemoteAddr returns the remote network address. +func (c *Conn) RemoteAddr() net.Addr { + return c.conn.RemoteAddr() +} + +// Write methods + +func (c *Conn) writeFatal(err error) error { + err = hideTempErr(err) + c.writeErrMu.Lock() + if c.writeErr == nil { + c.writeErr = err + } + c.writeErrMu.Unlock() + return err +} + +func (c *Conn) read(n int) ([]byte, error) { + p, err := c.br.Peek(n) + if err == io.EOF { + err = errUnexpectedEOF + } + c.br.Discard(len(p)) + return p, err +} + +func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error { + <-c.mu + defer func() { c.mu <- struct{}{} }() + + c.writeErrMu.Lock() + err := c.writeErr + c.writeErrMu.Unlock() + if err != nil { + return err + } + + c.conn.SetWriteDeadline(deadline) + if len(buf1) == 0 { + _, err = c.conn.Write(buf0) + } else { + err = c.writeBufs(buf0, buf1) + } + if err != nil { + return c.writeFatal(err) + } + if frameType == CloseMessage { + c.writeFatal(ErrCloseSent) + } + return nil +} + +// WriteControl writes a control message with the given deadline. The allowed +// message types are CloseMessage, PingMessage and PongMessage. +func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error { + if !isControl(messageType) { + return errBadWriteOpCode + } + if len(data) > maxControlFramePayloadSize { + return errInvalidControlFrame + } + + b0 := byte(messageType) | finalBit + b1 := byte(len(data)) + if !c.isServer { + b1 |= maskBit + } + + buf := make([]byte, 0, maxFrameHeaderSize+maxControlFramePayloadSize) + buf = append(buf, b0, b1) + + if c.isServer { + buf = append(buf, data...) + } else { + key := newMaskKey() + buf = append(buf, key[:]...) + buf = append(buf, data...) + maskBytes(key, 0, buf[6:]) + } + + d := 1000 * time.Hour + if !deadline.IsZero() { + d = deadline.Sub(time.Now()) + if d < 0 { + return errWriteTimeout + } + } + + timer := time.NewTimer(d) + select { + case <-c.mu: + timer.Stop() + case <-timer.C: + return errWriteTimeout + } + defer func() { c.mu <- struct{}{} }() + + c.writeErrMu.Lock() + err := c.writeErr + c.writeErrMu.Unlock() + if err != nil { + return err + } + + c.conn.SetWriteDeadline(deadline) + _, err = c.conn.Write(buf) + if err != nil { + return c.writeFatal(err) + } + if messageType == CloseMessage { + c.writeFatal(ErrCloseSent) + } + return err +} + +// beginMessage prepares a connection and message writer for a new message. +func (c *Conn) beginMessage(mw *messageWriter, messageType int) error { + // Close previous writer if not already closed by the application. It's + // probably better to return an error in this situation, but we cannot + // change this without breaking existing applications. + if c.writer != nil { + c.writer.Close() + c.writer = nil + } + + if !isControl(messageType) && !isData(messageType) { + return errBadWriteOpCode + } + + c.writeErrMu.Lock() + err := c.writeErr + c.writeErrMu.Unlock() + if err != nil { + return err + } + + mw.c = c + mw.frameType = messageType + mw.pos = maxFrameHeaderSize + + if c.writeBuf == nil { + wpd, ok := c.writePool.Get().(writePoolData) + if ok { + c.writeBuf = wpd.buf + } else { + c.writeBuf = make([]byte, c.writeBufSize) + } + } + return nil +} + +// NextWriter returns a writer for the next message to send. The writer's Close +// method flushes the complete message to the network. +// +// There can be at most one open writer on a connection. NextWriter closes the +// previous writer if the application has not already done so. +// +// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and +// PongMessage) are supported. +func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) { + var mw messageWriter + if err := c.beginMessage(&mw, messageType); err != nil { + return nil, err + } + c.writer = &mw + if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) { + w := c.newCompressionWriter(c.writer, c.compressionLevel) + mw.compress = true + c.writer = w + } + return c.writer, nil +} + +type messageWriter struct { + c *Conn + compress bool // whether next call to flushFrame should set RSV1 + pos int // end of data in writeBuf. + frameType int // type of the current frame. + err error +} + +func (w *messageWriter) endMessage(err error) error { + if w.err != nil { + return err + } + c := w.c + w.err = err + c.writer = nil + if c.writePool != nil { + c.writePool.Put(writePoolData{buf: c.writeBuf}) + c.writeBuf = nil + } + return err +} + +// flushFrame writes buffered data and extra as a frame to the network. The +// final argument indicates that this is the last frame in the message. +func (w *messageWriter) flushFrame(final bool, extra []byte) error { + c := w.c + length := w.pos - maxFrameHeaderSize + len(extra) + + // Check for invalid control frames. + if isControl(w.frameType) && + (!final || length > maxControlFramePayloadSize) { + return w.endMessage(errInvalidControlFrame) + } + + b0 := byte(w.frameType) + if final { + b0 |= finalBit + } + if w.compress { + b0 |= rsv1Bit + } + w.compress = false + + b1 := byte(0) + if !c.isServer { + b1 |= maskBit + } + + // Assume that the frame starts at beginning of c.writeBuf. + framePos := 0 + if c.isServer { + // Adjust up if mask not included in the header. + framePos = 4 + } + + switch { + case length >= 65536: + c.writeBuf[framePos] = b0 + c.writeBuf[framePos+1] = b1 | 127 + binary.BigEndian.PutUint64(c.writeBuf[framePos+2:], uint64(length)) + case length > 125: + framePos += 6 + c.writeBuf[framePos] = b0 + c.writeBuf[framePos+1] = b1 | 126 + binary.BigEndian.PutUint16(c.writeBuf[framePos+2:], uint16(length)) + default: + framePos += 8 + c.writeBuf[framePos] = b0 + c.writeBuf[framePos+1] = b1 | byte(length) + } + + if !c.isServer { + key := newMaskKey() + copy(c.writeBuf[maxFrameHeaderSize-4:], key[:]) + maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos]) + if len(extra) > 0 { + return w.endMessage(c.writeFatal(errors.New("websocket: internal error, extra used in client mode"))) + } + } + + // Write the buffers to the connection with best-effort detection of + // concurrent writes. See the concurrency section in the package + // documentation for more info. + + if c.isWriting { + panic("concurrent write to websocket connection") + } + c.isWriting = true + + err := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra) + + if !c.isWriting { + panic("concurrent write to websocket connection") + } + c.isWriting = false + + if err != nil { + return w.endMessage(err) + } + + if final { + w.endMessage(errWriteClosed) + return nil + } + + // Setup for next frame. + w.pos = maxFrameHeaderSize + w.frameType = continuationFrame + return nil +} + +func (w *messageWriter) ncopy(max int) (int, error) { + n := len(w.c.writeBuf) - w.pos + if n <= 0 { + if err := w.flushFrame(false, nil); err != nil { + return 0, err + } + n = len(w.c.writeBuf) - w.pos + } + if n > max { + n = max + } + return n, nil +} + +func (w *messageWriter) Write(p []byte) (int, error) { + if w.err != nil { + return 0, w.err + } + + if len(p) > 2*len(w.c.writeBuf) && w.c.isServer { + // Don't buffer large messages. + err := w.flushFrame(false, p) + if err != nil { + return 0, err + } + return len(p), nil + } + + nn := len(p) + for len(p) > 0 { + n, err := w.ncopy(len(p)) + if err != nil { + return 0, err + } + copy(w.c.writeBuf[w.pos:], p[:n]) + w.pos += n + p = p[n:] + } + return nn, nil +} + +func (w *messageWriter) WriteString(p string) (int, error) { + if w.err != nil { + return 0, w.err + } + + nn := len(p) + for len(p) > 0 { + n, err := w.ncopy(len(p)) + if err != nil { + return 0, err + } + copy(w.c.writeBuf[w.pos:], p[:n]) + w.pos += n + p = p[n:] + } + return nn, nil +} + +func (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) { + if w.err != nil { + return 0, w.err + } + for { + if w.pos == len(w.c.writeBuf) { + err = w.flushFrame(false, nil) + if err != nil { + break + } + } + var n int + n, err = r.Read(w.c.writeBuf[w.pos:]) + w.pos += n + nn += int64(n) + if err != nil { + if err == io.EOF { + err = nil + } + break + } + } + return nn, err +} + +func (w *messageWriter) Close() error { + if w.err != nil { + return w.err + } + return w.flushFrame(true, nil) +} + +// WritePreparedMessage writes prepared message into connection. +func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error { + frameType, frameData, err := pm.frame(prepareKey{ + isServer: c.isServer, + compress: c.newCompressionWriter != nil && c.enableWriteCompression && isData(pm.messageType), + compressionLevel: c.compressionLevel, + }) + if err != nil { + return err + } + if c.isWriting { + panic("concurrent write to websocket connection") + } + c.isWriting = true + err = c.write(frameType, c.writeDeadline, frameData, nil) + if !c.isWriting { + panic("concurrent write to websocket connection") + } + c.isWriting = false + return err +} + +// WriteMessage is a helper method for getting a writer using NextWriter, +// writing the message and closing the writer. +func (c *Conn) WriteMessage(messageType int, data []byte) error { + + if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) { + // Fast path with no allocations and single frame. + + var mw messageWriter + if err := c.beginMessage(&mw, messageType); err != nil { + return err + } + n := copy(c.writeBuf[mw.pos:], data) + mw.pos += n + data = data[n:] + return mw.flushFrame(true, data) + } + + w, err := c.NextWriter(messageType) + if err != nil { + return err + } + if _, err = w.Write(data); err != nil { + return err + } + return w.Close() +} + +// SetWriteDeadline sets the write deadline on the underlying network +// connection. After a write has timed out, the websocket state is corrupt and +// all future writes will return an error. A zero value for t means writes will +// not time out. +func (c *Conn) SetWriteDeadline(t time.Time) error { + c.writeDeadline = t + return nil +} + +// Read methods + +func (c *Conn) advanceFrame() (int, error) { + // 1. Skip remainder of previous frame. + + if c.readRemaining > 0 { + if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil { + return noFrame, err + } + } + + // 2. Read and parse first two bytes of frame header. + + p, err := c.read(2) + if err != nil { + return noFrame, err + } + + final := p[0]&finalBit != 0 + frameType := int(p[0] & 0xf) + mask := p[1]&maskBit != 0 + c.setReadRemaining(int64(p[1] & 0x7f)) + + c.readDecompress = false + if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 { + c.readDecompress = true + p[0] &^= rsv1Bit + } + + if rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 { + return noFrame, c.handleProtocolError("unexpected reserved bits 0x" + strconv.FormatInt(int64(rsv), 16)) + } + + switch frameType { + case CloseMessage, PingMessage, PongMessage: + if c.readRemaining > maxControlFramePayloadSize { + return noFrame, c.handleProtocolError("control frame length > 125") + } + if !final { + return noFrame, c.handleProtocolError("control frame not final") + } + case TextMessage, BinaryMessage: + if !c.readFinal { + return noFrame, c.handleProtocolError("message start before final message frame") + } + c.readFinal = final + case continuationFrame: + if c.readFinal { + return noFrame, c.handleProtocolError("continuation after final message frame") + } + c.readFinal = final + default: + return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType)) + } + + // 3. Read and parse frame length as per + // https://tools.ietf.org/html/rfc6455#section-5.2 + // + // The length of the "Payload data", in bytes: if 0-125, that is the payload + // length. + // - If 126, the following 2 bytes interpreted as a 16-bit unsigned + // integer are the payload length. + // - If 127, the following 8 bytes interpreted as + // a 64-bit unsigned integer (the most significant bit MUST be 0) are the + // payload length. Multibyte length quantities are expressed in network byte + // order. + + switch c.readRemaining { + case 126: + p, err := c.read(2) + if err != nil { + return noFrame, err + } + + if err := c.setReadRemaining(int64(binary.BigEndian.Uint16(p))); err != nil { + return noFrame, err + } + case 127: + p, err := c.read(8) + if err != nil { + return noFrame, err + } + + if err := c.setReadRemaining(int64(binary.BigEndian.Uint64(p))); err != nil { + return noFrame, err + } + } + + // 4. Handle frame masking. + + if mask != c.isServer { + return noFrame, c.handleProtocolError("incorrect mask flag") + } + + if mask { + c.readMaskPos = 0 + p, err := c.read(len(c.readMaskKey)) + if err != nil { + return noFrame, err + } + copy(c.readMaskKey[:], p) + } + + // 5. For text and binary messages, enforce read limit and return. + + if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage { + + c.readLength += c.readRemaining + // Don't allow readLength to overflow in the presence of a large readRemaining + // counter. + if c.readLength < 0 { + return noFrame, ErrReadLimit + } + + if c.readLimit > 0 && c.readLength > c.readLimit { + c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)) + return noFrame, ErrReadLimit + } + + return frameType, nil + } + + // 6. Read control frame payload. + + var payload []byte + if c.readRemaining > 0 { + payload, err = c.read(int(c.readRemaining)) + c.setReadRemaining(0) + if err != nil { + return noFrame, err + } + if c.isServer { + maskBytes(c.readMaskKey, 0, payload) + } + } + + // 7. Process control frame payload. + + switch frameType { + case PongMessage: + if err := c.handlePong(string(payload)); err != nil { + return noFrame, err + } + case PingMessage: + if err := c.handlePing(string(payload)); err != nil { + return noFrame, err + } + case CloseMessage: + closeCode := CloseNoStatusReceived + closeText := "" + if len(payload) >= 2 { + closeCode = int(binary.BigEndian.Uint16(payload)) + if !isValidReceivedCloseCode(closeCode) { + return noFrame, c.handleProtocolError("invalid close code") + } + closeText = string(payload[2:]) + if !utf8.ValidString(closeText) { + return noFrame, c.handleProtocolError("invalid utf8 payload in close frame") + } + } + if err := c.handleClose(closeCode, closeText); err != nil { + return noFrame, err + } + return noFrame, &CloseError{Code: closeCode, Text: closeText} + } + + return frameType, nil +} + +func (c *Conn) handleProtocolError(message string) error { + c.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait)) + return errors.New("websocket: " + message) +} + +// NextReader returns the next data message received from the peer. The +// returned messageType is either TextMessage or BinaryMessage. +// +// There can be at most one open reader on a connection. NextReader discards +// the previous message if the application has not already consumed it. +// +// Applications must break out of the application's read loop when this method +// returns a non-nil error value. Errors returned from this method are +// permanent. Once this method returns a non-nil error, all subsequent calls to +// this method return the same error. +func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { + // Close previous reader, only relevant for decompression. + if c.reader != nil { + c.reader.Close() + c.reader = nil + } + + c.messageReader = nil + c.readLength = 0 + + for c.readErr == nil { + frameType, err := c.advanceFrame() + if err != nil { + c.readErr = hideTempErr(err) + break + } + + if frameType == TextMessage || frameType == BinaryMessage { + c.messageReader = &messageReader{c} + c.reader = c.messageReader + if c.readDecompress { + c.reader = c.newDecompressionReader(c.reader) + } + return frameType, c.reader, nil + } + } + + // Applications that do handle the error returned from this method spin in + // tight loop on connection failure. To help application developers detect + // this error, panic on repeated reads to the failed connection. + c.readErrCount++ + if c.readErrCount >= 1000 { + panic("repeated read on failed websocket connection") + } + + return noFrame, nil, c.readErr +} + +type messageReader struct{ c *Conn } + +func (r *messageReader) Read(b []byte) (int, error) { + c := r.c + if c.messageReader != r { + return 0, io.EOF + } + + for c.readErr == nil { + + if c.readRemaining > 0 { + if int64(len(b)) > c.readRemaining { + b = b[:c.readRemaining] + } + n, err := c.br.Read(b) + c.readErr = hideTempErr(err) + if c.isServer { + c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n]) + } + rem := c.readRemaining + rem -= int64(n) + c.setReadRemaining(rem) + if c.readRemaining > 0 && c.readErr == io.EOF { + c.readErr = errUnexpectedEOF + } + return n, c.readErr + } + + if c.readFinal { + c.messageReader = nil + return 0, io.EOF + } + + frameType, err := c.advanceFrame() + switch { + case err != nil: + c.readErr = hideTempErr(err) + case frameType == TextMessage || frameType == BinaryMessage: + c.readErr = errors.New("websocket: internal error, unexpected text or binary in Reader") + } + } + + err := c.readErr + if err == io.EOF && c.messageReader == r { + err = errUnexpectedEOF + } + return 0, err +} + +func (r *messageReader) Close() error { + return nil +} + +// ReadMessage is a helper method for getting a reader using NextReader and +// reading from that reader to a buffer. +func (c *Conn) ReadMessage() (messageType int, p []byte, err error) { + var r io.Reader + messageType, r, err = c.NextReader() + if err != nil { + return messageType, nil, err + } + p, err = ioutil.ReadAll(r) + return messageType, p, err +} + +// SetReadDeadline sets the read deadline on the underlying network connection. +// After a read has timed out, the websocket connection state is corrupt and +// all future reads will return an error. A zero value for t means reads will +// not time out. +func (c *Conn) SetReadDeadline(t time.Time) error { + return c.conn.SetReadDeadline(t) +} + +// SetReadLimit sets the maximum size in bytes for a message read from the peer. If a +// message exceeds the limit, the connection sends a close message to the peer +// and returns ErrReadLimit to the application. +func (c *Conn) SetReadLimit(limit int64) { + c.readLimit = limit +} + +// CloseHandler returns the current close handler +func (c *Conn) CloseHandler() func(code int, text string) error { + return c.handleClose +} + +// SetCloseHandler sets the handler for close messages received from the peer. +// The code argument to h is the received close code or CloseNoStatusReceived +// if the close message is empty. The default close handler sends a close +// message back to the peer. +// +// The handler function is called from the NextReader, ReadMessage and message +// reader Read methods. The application must read the connection to process +// close messages as described in the section on Control Messages above. +// +// The connection read methods return a CloseError when a close message is +// received. Most applications should handle close messages as part of their +// normal error handling. Applications should only set a close handler when the +// application must perform some action before sending a close message back to +// the peer. +func (c *Conn) SetCloseHandler(h func(code int, text string) error) { + if h == nil { + h = func(code int, text string) error { + message := FormatCloseMessage(code, "") + c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)) + return nil + } + } + c.handleClose = h +} + +// PingHandler returns the current ping handler +func (c *Conn) PingHandler() func(appData string) error { + return c.handlePing +} + +// SetPingHandler sets the handler for ping messages received from the peer. +// The appData argument to h is the PING message application data. The default +// ping handler sends a pong to the peer. +// +// The handler function is called from the NextReader, ReadMessage and message +// reader Read methods. The application must read the connection to process +// ping messages as described in the section on Control Messages above. +func (c *Conn) SetPingHandler(h func(appData string) error) { + if h == nil { + h = func(message string) error { + err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait)) + if err == ErrCloseSent { + return nil + } else if e, ok := err.(net.Error); ok && e.Temporary() { + return nil + } + return err + } + } + c.handlePing = h +} + +// PongHandler returns the current pong handler +func (c *Conn) PongHandler() func(appData string) error { + return c.handlePong +} + +// SetPongHandler sets the handler for pong messages received from the peer. +// The appData argument to h is the PONG message application data. The default +// pong handler does nothing. +// +// The handler function is called from the NextReader, ReadMessage and message +// reader Read methods. The application must read the connection to process +// pong messages as described in the section on Control Messages above. +func (c *Conn) SetPongHandler(h func(appData string) error) { + if h == nil { + h = func(string) error { return nil } + } + c.handlePong = h +} + +// UnderlyingConn returns the internal net.Conn. This can be used to further +// modifications to connection specific flags. +func (c *Conn) UnderlyingConn() net.Conn { + return c.conn +} + +// EnableWriteCompression enables and disables write compression of +// subsequent text and binary messages. This function is a noop if +// compression was not negotiated with the peer. +func (c *Conn) EnableWriteCompression(enable bool) { + c.enableWriteCompression = enable +} + +// SetCompressionLevel sets the flate compression level for subsequent text and +// binary messages. This function is a noop if compression was not negotiated +// with the peer. See the compress/flate package for a description of +// compression levels. +func (c *Conn) SetCompressionLevel(level int) error { + if !isValidCompressionLevel(level) { + return errors.New("websocket: invalid compression level") + } + c.compressionLevel = level + return nil +} + +// FormatCloseMessage formats closeCode and text as a WebSocket close message. +// An empty message is returned for code CloseNoStatusReceived. +func FormatCloseMessage(closeCode int, text string) []byte { + if closeCode == CloseNoStatusReceived { + // Return empty message because it's illegal to send + // CloseNoStatusReceived. Return non-nil value in case application + // checks for nil. + return []byte{} + } + buf := make([]byte, 2+len(text)) + binary.BigEndian.PutUint16(buf, uint16(closeCode)) + copy(buf[2:], text) + return buf +} diff --git a/vendor/github.com/gorilla/websocket/conn_write.go b/vendor/github.com/gorilla/websocket/conn_write.go @@ -0,0 +1,15 @@ +// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.8 + +package websocket + +import "net" + +func (c *Conn) writeBufs(bufs ...[]byte) error { + b := net.Buffers(bufs) + _, err := b.WriteTo(c.conn) + return err +} diff --git a/vendor/github.com/gorilla/websocket/conn_write_legacy.go b/vendor/github.com/gorilla/websocket/conn_write_legacy.go @@ -0,0 +1,18 @@ +// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !go1.8 + +package websocket + +func (c *Conn) writeBufs(bufs ...[]byte) error { + for _, buf := range bufs { + if len(buf) > 0 { + if _, err := c.conn.Write(buf); err != nil { + return err + } + } + } + return nil +} diff --git a/vendor/github.com/gorilla/websocket/doc.go b/vendor/github.com/gorilla/websocket/doc.go @@ -0,0 +1,227 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package websocket implements the WebSocket protocol defined in RFC 6455. +// +// Overview +// +// The Conn type represents a WebSocket connection. A server application calls +// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn: +// +// var upgrader = websocket.Upgrader{ +// ReadBufferSize: 1024, +// WriteBufferSize: 1024, +// } +// +// func handler(w http.ResponseWriter, r *http.Request) { +// conn, err := upgrader.Upgrade(w, r, nil) +// if err != nil { +// log.Println(err) +// return +// } +// ... Use conn to send and receive messages. +// } +// +// Call the connection's WriteMessage and ReadMessage methods to send and +// receive messages as a slice of bytes. This snippet of code shows how to echo +// messages using these methods: +// +// for { +// messageType, p, err := conn.ReadMessage() +// if err != nil { +// log.Println(err) +// return +// } +// if err := conn.WriteMessage(messageType, p); err != nil { +// log.Println(err) +// return +// } +// } +// +// In above snippet of code, p is a []byte and messageType is an int with value +// websocket.BinaryMessage or websocket.TextMessage. +// +// An application can also send and receive messages using the io.WriteCloser +// and io.Reader interfaces. To send a message, call the connection NextWriter +// method to get an io.WriteCloser, write the message to the writer and close +// the writer when done. To receive a message, call the connection NextReader +// method to get an io.Reader and read until io.EOF is returned. This snippet +// shows how to echo messages using the NextWriter and NextReader methods: +// +// for { +// messageType, r, err := conn.NextReader() +// if err != nil { +// return +// } +// w, err := conn.NextWriter(messageType) +// if err != nil { +// return err +// } +// if _, err := io.Copy(w, r); err != nil { +// return err +// } +// if err := w.Close(); err != nil { +// return err +// } +// } +// +// Data Messages +// +// The WebSocket protocol distinguishes between text and binary data messages. +// Text messages are interpreted as UTF-8 encoded text. The interpretation of +// binary messages is left to the application. +// +// This package uses the TextMessage and BinaryMessage integer constants to +// identify the two data message types. The ReadMessage and NextReader methods +// return the type of the received message. The messageType argument to the +// WriteMessage and NextWriter methods specifies the type of a sent message. +// +// It is the application's responsibility to ensure that text messages are +// valid UTF-8 encoded text. +// +// Control Messages +// +// The WebSocket protocol defines three types of control messages: close, ping +// and pong. Call the connection WriteControl, WriteMessage or NextWriter +// methods to send a control message to the peer. +// +// Connections handle received close messages by calling the handler function +// set with the SetCloseHandler method and by returning a *CloseError from the +// NextReader, ReadMessage or the message Read method. The default close +// handler sends a close message to the peer. +// +// Connections handle received ping messages by calling the handler function +// set with the SetPingHandler method. The default ping handler sends a pong +// message to the peer. +// +// Connections handle received pong messages by calling the handler function +// set with the SetPongHandler method. The default pong handler does nothing. +// If an application sends ping messages, then the application should set a +// pong handler to receive the corresponding pong. +// +// The control message handler functions are called from the NextReader, +// ReadMessage and message reader Read methods. The default close and ping +// handlers can block these methods for a short time when the handler writes to +// the connection. +// +// The application must read the connection to process close, ping and pong +// messages sent from the peer. If the application is not otherwise interested +// in messages from the peer, then the application should start a goroutine to +// read and discard messages from the peer. A simple example is: +// +// func readLoop(c *websocket.Conn) { +// for { +// if _, _, err := c.NextReader(); err != nil { +// c.Close() +// break +// } +// } +// } +// +// Concurrency +// +// Connections support one concurrent reader and one concurrent writer. +// +// Applications are responsible for ensuring that no more than one goroutine +// calls the write methods (NextWriter, SetWriteDeadline, WriteMessage, +// WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and +// that no more than one goroutine calls the read methods (NextReader, +// SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler) +// concurrently. +// +// The Close and WriteControl methods can be called concurrently with all other +// methods. +// +// Origin Considerations +// +// Web browsers allow Javascript applications to open a WebSocket connection to +// any host. It's up to the server to enforce an origin policy using the Origin +// request header sent by the browser. +// +// The Upgrader calls the function specified in the CheckOrigin field to check +// the origin. If the CheckOrigin function returns false, then the Upgrade +// method fails the WebSocket handshake with HTTP status 403. +// +// If the CheckOrigin field is nil, then the Upgrader uses a safe default: fail +// the handshake if the Origin request header is present and the Origin host is +// not equal to the Host request header. +// +// The deprecated package-level Upgrade function does not perform origin +// checking. The application is responsible for checking the Origin header +// before calling the Upgrade function. +// +// Buffers +// +// Connections buffer network input and output to reduce the number +// of system calls when reading or writing messages. +// +// Write buffers are also used for constructing WebSocket frames. See RFC 6455, +// Section 5 for a discussion of message framing. A WebSocket frame header is +// written to the network each time a write buffer is flushed to the network. +// Decreasing the size of the write buffer can increase the amount of framing +// overhead on the connection. +// +// The buffer sizes in bytes are specified by the ReadBufferSize and +// WriteBufferSize fields in the Dialer and Upgrader. The Dialer uses a default +// size of 4096 when a buffer size field is set to zero. The Upgrader reuses +// buffers created by the HTTP server when a buffer size field is set to zero. +// The HTTP server buffers have a size of 4096 at the time of this writing. +// +// The buffer sizes do not limit the size of a message that can be read or +// written by a connection. +// +// Buffers are held for the lifetime of the connection by default. If the +// Dialer or Upgrader WriteBufferPool field is set, then a connection holds the +// write buffer only when writing a message. +// +// Applications should tune the buffer sizes to balance memory use and +// performance. Increasing the buffer size uses more memory, but can reduce the +// number of system calls to read or write the network. In the case of writing, +// increasing the buffer size can reduce the number of frame headers written to +// the network. +// +// Some guidelines for setting buffer parameters are: +// +// Limit the buffer sizes to the maximum expected message size. Buffers larger +// than the largest message do not provide any benefit. +// +// Depending on the distribution of message sizes, setting the buffer size to +// a value less than the maximum expected message size can greatly reduce memory +// use with a small impact on performance. Here's an example: If 99% of the +// messages are smaller than 256 bytes and the maximum message size is 512 +// bytes, then a buffer size of 256 bytes will result in 1.01 more system calls +// than a buffer size of 512 bytes. The memory savings is 50%. +// +// A write buffer pool is useful when the application has a modest number +// writes over a large number of connections. when buffers are pooled, a larger +// buffer size has a reduced impact on total memory use and has the benefit of +// reducing system calls and frame overhead. +// +// Compression EXPERIMENTAL +// +// Per message compression extensions (RFC 7692) are experimentally supported +// by this package in a limited capacity. Setting the EnableCompression option +// to true in Dialer or Upgrader will attempt to negotiate per message deflate +// support. +// +// var upgrader = websocket.Upgrader{ +// EnableCompression: true, +// } +// +// If compression was successfully negotiated with the connection's peer, any +// message received in compressed form will be automatically decompressed. +// All Read methods will return uncompressed bytes. +// +// Per message compression of messages written to a connection can be enabled +// or disabled by calling the corresponding Conn method: +// +// conn.EnableWriteCompression(false) +// +// Currently this package does not support compression with "context takeover". +// This means that messages must be compressed and decompressed in isolation, +// without retaining sliding window or dictionary state across messages. For +// more details refer to RFC 7692. +// +// Use of compression is experimental and may result in decreased performance. +package websocket diff --git a/vendor/github.com/gorilla/websocket/go.mod b/vendor/github.com/gorilla/websocket/go.mod @@ -0,0 +1,3 @@ +module github.com/gorilla/websocket + +go 1.12 diff --git a/vendor/github.com/gorilla/websocket/go.sum b/vendor/github.com/gorilla/websocket/go.sum diff --git a/vendor/github.com/gorilla/websocket/join.go b/vendor/github.com/gorilla/websocket/join.go @@ -0,0 +1,42 @@ +// Copyright 2019 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "io" + "strings" +) + +// JoinMessages concatenates received messages to create a single io.Reader. +// The string term is appended to each message. The returned reader does not +// support concurrent calls to the Read method. +func JoinMessages(c *Conn, term string) io.Reader { + return &joinReader{c: c, term: term} +} + +type joinReader struct { + c *Conn + term string + r io.Reader +} + +func (r *joinReader) Read(p []byte) (int, error) { + if r.r == nil { + var err error + _, r.r, err = r.c.NextReader() + if err != nil { + return 0, err + } + if r.term != "" { + r.r = io.MultiReader(r.r, strings.NewReader(r.term)) + } + } + n, err := r.r.Read(p) + if err == io.EOF { + err = nil + r.r = nil + } + return n, err +} diff --git a/vendor/github.com/gorilla/websocket/json.go b/vendor/github.com/gorilla/websocket/json.go @@ -0,0 +1,60 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "encoding/json" + "io" +) + +// WriteJSON writes the JSON encoding of v as a message. +// +// Deprecated: Use c.WriteJSON instead. +func WriteJSON(c *Conn, v interface{}) error { + return c.WriteJSON(v) +} + +// WriteJSON writes the JSON encoding of v as a message. +// +// See the documentation for encoding/json Marshal for details about the +// conversion of Go values to JSON. +func (c *Conn) WriteJSON(v interface{}) error { + w, err := c.NextWriter(TextMessage) + if err != nil { + return err + } + err1 := json.NewEncoder(w).Encode(v) + err2 := w.Close() + if err1 != nil { + return err1 + } + return err2 +} + +// ReadJSON reads the next JSON-encoded message from the connection and stores +// it in the value pointed to by v. +// +// Deprecated: Use c.ReadJSON instead. +func ReadJSON(c *Conn, v interface{}) error { + return c.ReadJSON(v) +} + +// ReadJSON reads the next JSON-encoded message from the connection and stores +// it in the value pointed to by v. +// +// See the documentation for the encoding/json Unmarshal function for details +// about the conversion of JSON to a Go value. +func (c *Conn) ReadJSON(v interface{}) error { + _, r, err := c.NextReader() + if err != nil { + return err + } + err = json.NewDecoder(r).Decode(v) + if err == io.EOF { + // One value is expected in the message. + err = io.ErrUnexpectedEOF + } + return err +} diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go @@ -0,0 +1,54 @@ +// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of +// this source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +// +build !appengine + +package websocket + +import "unsafe" + +const wordSize = int(unsafe.Sizeof(uintptr(0))) + +func maskBytes(key [4]byte, pos int, b []byte) int { + // Mask one byte at a time for small buffers. + if len(b) < 2*wordSize { + for i := range b { + b[i] ^= key[pos&3] + pos++ + } + return pos & 3 + } + + // Mask one byte at a time to word boundary. + if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { + n = wordSize - n + for i := range b[:n] { + b[i] ^= key[pos&3] + pos++ + } + b = b[n:] + } + + // Create aligned word size key. + var k [wordSize]byte + for i := range k { + k[i] = key[(pos+i)&3] + } + kw := *(*uintptr)(unsafe.Pointer(&k)) + + // Mask one word at a time. + n := (len(b) / wordSize) * wordSize + for i := 0; i < n; i += wordSize { + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw + } + + // Mask one byte at a time for remaining bytes. + b = b[n:] + for i := range b { + b[i] ^= key[pos&3] + pos++ + } + + return pos & 3 +} diff --git a/vendor/github.com/gorilla/websocket/mask_safe.go b/vendor/github.com/gorilla/websocket/mask_safe.go @@ -0,0 +1,15 @@ +// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of +// this source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +// +build appengine + +package websocket + +func maskBytes(key [4]byte, pos int, b []byte) int { + for i := range b { + b[i] ^= key[pos&3] + pos++ + } + return pos & 3 +} diff --git a/vendor/github.com/gorilla/websocket/prepared.go b/vendor/github.com/gorilla/websocket/prepared.go @@ -0,0 +1,102 @@ +// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "bytes" + "net" + "sync" + "time" +) + +// PreparedMessage caches on the wire representations of a message payload. +// Use PreparedMessage to efficiently send a message payload to multiple +// connections. PreparedMessage is especially useful when compression is used +// because the CPU and memory expensive compression operation can be executed +// once for a given set of compression options. +type PreparedMessage struct { + messageType int + data []byte + mu sync.Mutex + frames map[prepareKey]*preparedFrame +} + +// prepareKey defines a unique set of options to cache prepared frames in PreparedMessage. +type prepareKey struct { + isServer bool + compress bool + compressionLevel int +} + +// preparedFrame contains data in wire representation. +type preparedFrame struct { + once sync.Once + data []byte +} + +// NewPreparedMessage returns an initialized PreparedMessage. You can then send +// it to connection using WritePreparedMessage method. Valid wire +// representation will be calculated lazily only once for a set of current +// connection options. +func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) { + pm := &PreparedMessage{ + messageType: messageType, + frames: make(map[prepareKey]*preparedFrame), + data: data, + } + + // Prepare a plain server frame. + _, frameData, err := pm.frame(prepareKey{isServer: true, compress: false}) + if err != nil { + return nil, err + } + + // To protect against caller modifying the data argument, remember the data + // copied to the plain server frame. + pm.data = frameData[len(frameData)-len(data):] + return pm, nil +} + +func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) { + pm.mu.Lock() + frame, ok := pm.frames[key] + if !ok { + frame = &preparedFrame{} + pm.frames[key] = frame + } + pm.mu.Unlock() + + var err error + frame.once.Do(func() { + // Prepare a frame using a 'fake' connection. + // TODO: Refactor code in conn.go to allow more direct construction of + // the frame. + mu := make(chan struct{}, 1) + mu <- struct{}{} + var nc prepareConn + c := &Conn{ + conn: &nc, + mu: mu, + isServer: key.isServer, + compressionLevel: key.compressionLevel, + enableWriteCompression: true, + writeBuf: make([]byte, defaultWriteBufferSize+maxFrameHeaderSize), + } + if key.compress { + c.newCompressionWriter = compressNoContextTakeover + } + err = c.WriteMessage(pm.messageType, pm.data) + frame.data = nc.buf.Bytes() + }) + return pm.messageType, frame.data, err +} + +type prepareConn struct { + buf bytes.Buffer + net.Conn +} + +func (pc *prepareConn) Write(p []byte) (int, error) { return pc.buf.Write(p) } +func (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil } diff --git a/vendor/github.com/gorilla/websocket/proxy.go b/vendor/github.com/gorilla/websocket/proxy.go @@ -0,0 +1,77 @@ +// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "bufio" + "encoding/base64" + "errors" + "net" + "net/http" + "net/url" + "strings" +) + +type netDialerFunc func(network, addr string) (net.Conn, error) + +func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) { + return fn(network, addr) +} + +func init() { + proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) { + return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil + }) +} + +type httpProxyDialer struct { + proxyURL *url.URL + forwardDial func(network, addr string) (net.Conn, error) +} + +func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) { + hostPort, _ := hostPortNoPort(hpd.proxyURL) + conn, err := hpd.forwardDial(network, hostPort) + if err != nil { + return nil, err + } + + connectHeader := make(http.Header) + if user := hpd.proxyURL.User; user != nil { + proxyUser := user.Username() + if proxyPassword, passwordSet := user.Password(); passwordSet { + credential := base64.StdEncoding.EncodeToString([]byte(proxyUser + ":" + proxyPassword)) + connectHeader.Set("Proxy-Authorization", "Basic "+credential) + } + } + + connectReq := &http.Request{ + Method: "CONNECT", + URL: &url.URL{Opaque: addr}, + Host: addr, + Header: connectHeader, + } + + if err := connectReq.Write(conn); err != nil { + conn.Close() + return nil, err + } + + // Read response. It's OK to use and discard buffered reader here becaue + // the remote server does not speak until spoken to. + br := bufio.NewReader(conn) + resp, err := http.ReadResponse(br, connectReq) + if err != nil { + conn.Close() + return nil, err + } + + if resp.StatusCode != 200 { + conn.Close() + f := strings.SplitN(resp.Status, " ", 2) + return nil, errors.New(f[1]) + } + return conn, nil +} diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go @@ -0,0 +1,363 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "bufio" + "errors" + "io" + "net/http" + "net/url" + "strings" + "time" +) + +// HandshakeError describes an error with the handshake from the peer. +type HandshakeError struct { + message string +} + +func (e HandshakeError) Error() string { return e.message } + +// Upgrader specifies parameters for upgrading an HTTP connection to a +// WebSocket connection. +type Upgrader struct { + // HandshakeTimeout specifies the duration for the handshake to complete. + HandshakeTimeout time.Duration + + // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer + // size is zero, then buffers allocated by the HTTP server are used. The + // I/O buffer sizes do not limit the size of the messages that can be sent + // or received. + ReadBufferSize, WriteBufferSize int + + // WriteBufferPool is a pool of buffers for write operations. If the value + // is not set, then write buffers are allocated to the connection for the + // lifetime of the connection. + // + // A pool is most useful when the application has a modest volume of writes + // across a large number of connections. + // + // Applications should use a single pool for each unique value of + // WriteBufferSize. + WriteBufferPool BufferPool + + // Subprotocols specifies the server's supported protocols in order of + // preference. If this field is not nil, then the Upgrade method negotiates a + // subprotocol by selecting the first match in this list with a protocol + // requested by the client. If there's no match, then no protocol is + // negotiated (the Sec-Websocket-Protocol header is not included in the + // handshake response). + Subprotocols []string + + // Error specifies the function for generating HTTP error responses. If Error + // is nil, then http.Error is used to generate the HTTP response. + Error func(w http.ResponseWriter, r *http.Request, status int, reason error) + + // CheckOrigin returns true if the request Origin header is acceptable. If + // CheckOrigin is nil, then a safe default is used: return false if the + // Origin request header is present and the origin host is not equal to + // request Host header. + // + // A CheckOrigin function should carefully validate the request origin to + // prevent cross-site request forgery. + CheckOrigin func(r *http.Request) bool + + // EnableCompression specify if the server should attempt to negotiate per + // message compression (RFC 7692). Setting this value to true does not + // guarantee that compression will be supported. Currently only "no context + // takeover" modes are supported. + EnableCompression bool +} + +func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) { + err := HandshakeError{reason} + if u.Error != nil { + u.Error(w, r, status, err) + } else { + w.Header().Set("Sec-Websocket-Version", "13") + http.Error(w, http.StatusText(status), status) + } + return nil, err +} + +// checkSameOrigin returns true if the origin is not set or is equal to the request host. +func checkSameOrigin(r *http.Request) bool { + origin := r.Header["Origin"] + if len(origin) == 0 { + return true + } + u, err := url.Parse(origin[0]) + if err != nil { + return false + } + return equalASCIIFold(u.Host, r.Host) +} + +func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string { + if u.Subprotocols != nil { + clientProtocols := Subprotocols(r) + for _, serverProtocol := range u.Subprotocols { + for _, clientProtocol := range clientProtocols { + if clientProtocol == serverProtocol { + return clientProtocol + } + } + } + } else if responseHeader != nil { + return responseHeader.Get("Sec-Websocket-Protocol") + } + return "" +} + +// Upgrade upgrades the HTTP server connection to the WebSocket protocol. +// +// The responseHeader is included in the response to the client's upgrade +// request. Use the responseHeader to specify cookies (Set-Cookie) and the +// application negotiated subprotocol (Sec-WebSocket-Protocol). +// +// If the upgrade fails, then Upgrade replies to the client with an HTTP error +// response. +func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) { + const badHandshake = "websocket: the client is not using the websocket protocol: " + + if !tokenListContainsValue(r.Header, "Connection", "upgrade") { + return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'upgrade' token not found in 'Connection' header") + } + + if !tokenListContainsValue(r.Header, "Upgrade", "websocket") { + return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'websocket' token not found in 'Upgrade' header") + } + + if r.Method != "GET" { + return u.returnError(w, r, http.StatusMethodNotAllowed, badHandshake+"request method is not GET") + } + + if !tokenListContainsValue(r.Header, "Sec-Websocket-Version", "13") { + return u.returnError(w, r, http.StatusBadRequest, "websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header") + } + + if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok { + return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-WebSocket-Extensions' headers are unsupported") + } + + checkOrigin := u.CheckOrigin + if checkOrigin == nil { + checkOrigin = checkSameOrigin + } + if !checkOrigin(r) { + return u.returnError(w, r, http.StatusForbidden, "websocket: request origin not allowed by Upgrader.CheckOrigin") + } + + challengeKey := r.Header.Get("Sec-Websocket-Key") + if challengeKey == "" { + return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header is missing or blank") + } + + subprotocol := u.selectSubprotocol(r, responseHeader) + + // Negotiate PMCE + var compress bool + if u.EnableCompression { + for _, ext := range parseExtensions(r.Header) { + if ext[""] != "permessage-deflate" { + continue + } + compress = true + break + } + } + + h, ok := w.(http.Hijacker) + if !ok { + return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker") + } + var brw *bufio.ReadWriter + netConn, brw, err := h.Hijack() + if err != nil { + return u.returnError(w, r, http.StatusInternalServerError, err.Error()) + } + + if brw.Reader.Buffered() > 0 { + netConn.Close() + return nil, errors.New("websocket: client sent data before handshake is complete") + } + + var br *bufio.Reader + if u.ReadBufferSize == 0 && bufioReaderSize(netConn, brw.Reader) > 256 { + // Reuse hijacked buffered reader as connection reader. + br = brw.Reader + } + + buf := bufioWriterBuffer(netConn, brw.Writer) + + var writeBuf []byte + if u.WriteBufferPool == nil && u.WriteBufferSize == 0 && len(buf) >= maxFrameHeaderSize+256 { + // Reuse hijacked write buffer as connection buffer. + writeBuf = buf + } + + c := newConn(netConn, true, u.ReadBufferSize, u.WriteBufferSize, u.WriteBufferPool, br, writeBuf) + c.subprotocol = subprotocol + + if compress { + c.newCompressionWriter = compressNoContextTakeover + c.newDecompressionReader = decompressNoContextTakeover + } + + // Use larger of hijacked buffer and connection write buffer for header. + p := buf + if len(c.writeBuf) > len(p) { + p = c.writeBuf + } + p = p[:0] + + p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...) + p = append(p, computeAcceptKey(challengeKey)...) + p = append(p, "\r\n"...) + if c.subprotocol != "" { + p = append(p, "Sec-WebSocket-Protocol: "...) + p = append(p, c.subprotocol...) + p = append(p, "\r\n"...) + } + if compress { + p = append(p, "Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...) + } + for k, vs := range responseHeader { + if k == "Sec-Websocket-Protocol" { + continue + } + for _, v := range vs { + p = append(p, k...) + p = append(p, ": "...) + for i := 0; i < len(v); i++ { + b := v[i] + if b <= 31 { + // prevent response splitting. + b = ' ' + } + p = append(p, b) + } + p = append(p, "\r\n"...) + } + } + p = append(p, "\r\n"...) + + // Clear deadlines set by HTTP server. + netConn.SetDeadline(time.Time{}) + + if u.HandshakeTimeout > 0 { + netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)) + } + if _, err = netConn.Write(p); err != nil { + netConn.Close() + return nil, err + } + if u.HandshakeTimeout > 0 { + netConn.SetWriteDeadline(time.Time{}) + } + + return c, nil +} + +// Upgrade upgrades the HTTP server connection to the WebSocket protocol. +// +// Deprecated: Use websocket.Upgrader instead. +// +// Upgrade does not perform origin checking. The application is responsible for +// checking the Origin header before calling Upgrade. An example implementation +// of the same origin policy check is: +// +// if req.Header.Get("Origin") != "http://"+req.Host { +// http.Error(w, "Origin not allowed", http.StatusForbidden) +// return +// } +// +// If the endpoint supports subprotocols, then the application is responsible +// for negotiating the protocol used on the connection. Use the Subprotocols() +// function to get the subprotocols requested by the client. Use the +// Sec-Websocket-Protocol response header to specify the subprotocol selected +// by the application. +// +// The responseHeader is included in the response to the client's upgrade +// request. Use the responseHeader to specify cookies (Set-Cookie) and the +// negotiated subprotocol (Sec-Websocket-Protocol). +// +// The connection buffers IO to the underlying network connection. The +// readBufSize and writeBufSize parameters specify the size of the buffers to +// use. Messages can be larger than the buffers. +// +// If the request is not a valid WebSocket handshake, then Upgrade returns an +// error of type HandshakeError. Applications should handle this error by +// replying to the client with an HTTP error response. +func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) { + u := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize} + u.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) { + // don't return errors to maintain backwards compatibility + } + u.CheckOrigin = func(r *http.Request) bool { + // allow all connections by default + return true + } + return u.Upgrade(w, r, responseHeader) +} + +// Subprotocols returns the subprotocols requested by the client in the +// Sec-Websocket-Protocol header. +func Subprotocols(r *http.Request) []string { + h := strings.TrimSpace(r.Header.Get("Sec-Websocket-Protocol")) + if h == "" { + return nil + } + protocols := strings.Split(h, ",") + for i := range protocols { + protocols[i] = strings.TrimSpace(protocols[i]) + } + return protocols +} + +// IsWebSocketUpgrade returns true if the client requested upgrade to the +// WebSocket protocol. +func IsWebSocketUpgrade(r *http.Request) bool { + return tokenListContainsValue(r.Header, "Connection", "upgrade") && + tokenListContainsValue(r.Header, "Upgrade", "websocket") +} + +// bufioReaderSize size returns the size of a bufio.Reader. +func bufioReaderSize(originalReader io.Reader, br *bufio.Reader) int { + // This code assumes that peek on a reset reader returns + // bufio.Reader.buf[:0]. + // TODO: Use bufio.Reader.Size() after Go 1.10 + br.Reset(originalReader) + if p, err := br.Peek(0); err == nil { + return cap(p) + } + return 0 +} + +// writeHook is an io.Writer that records the last slice passed to it vio +// io.Writer.Write. +type writeHook struct { + p []byte +} + +func (wh *writeHook) Write(p []byte) (int, error) { + wh.p = p + return len(p), nil +} + +// bufioWriterBuffer grabs the buffer from a bufio.Writer. +func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte { + // This code assumes that bufio.Writer.buf[:1] is passed to the + // bufio.Writer's underlying writer. + var wh writeHook + bw.Reset(&wh) + bw.WriteByte(0) + bw.Flush() + + bw.Reset(originalWriter) + + return wh.p[:cap(wh.p)] +} diff --git a/vendor/github.com/gorilla/websocket/trace.go b/vendor/github.com/gorilla/websocket/trace.go @@ -0,0 +1,19 @@ +// +build go1.8 + +package websocket + +import ( + "crypto/tls" + "net/http/httptrace" +) + +func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error { + if trace.TLSHandshakeStart != nil { + trace.TLSHandshakeStart() + } + err := doHandshake(tlsConn, cfg) + if trace.TLSHandshakeDone != nil { + trace.TLSHandshakeDone(tlsConn.ConnectionState(), err) + } + return err +} diff --git a/vendor/github.com/gorilla/websocket/trace_17.go b/vendor/github.com/gorilla/websocket/trace_17.go @@ -0,0 +1,12 @@ +// +build !go1.8 + +package websocket + +import ( + "crypto/tls" + "net/http/httptrace" +) + +func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error { + return doHandshake(tlsConn, cfg) +} diff --git a/vendor/github.com/gorilla/websocket/util.go b/vendor/github.com/gorilla/websocket/util.go @@ -0,0 +1,283 @@ +// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package websocket + +import ( + "crypto/rand" + "crypto/sha1" + "encoding/base64" + "io" + "net/http" + "strings" + "unicode/utf8" +) + +var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") + +func computeAcceptKey(challengeKey string) string { + h := sha1.New() + h.Write([]byte(challengeKey)) + h.Write(keyGUID) + return base64.StdEncoding.EncodeToString(h.Sum(nil)) +} + +func generateChallengeKey() (string, error) { + p := make([]byte, 16) + if _, err := io.ReadFull(rand.Reader, p); err != nil { + return "", err + } + return base64.StdEncoding.EncodeToString(p), nil +} + +// Token octets per RFC 2616. +var isTokenOctet = [256]bool{ + '!': true, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '*': true, + '+': true, + '-': true, + '.': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'W': true, + 'V': true, + 'X': true, + 'Y': true, + 'Z': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '|': true, + '~': true, +} + +// skipSpace returns a slice of the string s with all leading RFC 2616 linear +// whitespace removed. +func skipSpace(s string) (rest string) { + i := 0 + for ; i < len(s); i++ { + if b := s[i]; b != ' ' && b != '\t' { + break + } + } + return s[i:] +} + +// nextToken returns the leading RFC 2616 token of s and the string following +// the token. +func nextToken(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + if !isTokenOctet[s[i]] { + break + } + } + return s[:i], s[i:] +} + +// nextTokenOrQuoted returns the leading token or quoted string per RFC 2616 +// and the string following the token or quoted string. +func nextTokenOrQuoted(s string) (value string, rest string) { + if !strings.HasPrefix(s, "\"") { + return nextToken(s) + } + s = s[1:] + for i := 0; i < len(s); i++ { + switch s[i] { + case '"': + return s[:i], s[i+1:] + case '\\': + p := make([]byte, len(s)-1) + j := copy(p, s[:i]) + escape := true + for i = i + 1; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + p[j] = b + j++ + case b == '\\': + escape = true + case b == '"': + return string(p[:j]), s[i+1:] + default: + p[j] = b + j++ + } + } + return "", "" + } + } + return "", "" +} + +// equalASCIIFold returns true if s is equal to t with ASCII case folding as +// defined in RFC 4790. +func equalASCIIFold(s, t string) bool { + for s != "" && t != "" { + sr, size := utf8.DecodeRuneInString(s) + s = s[size:] + tr, size := utf8.DecodeRuneInString(t) + t = t[size:] + if sr == tr { + continue + } + if 'A' <= sr && sr <= 'Z' { + sr = sr + 'a' - 'A' + } + if 'A' <= tr && tr <= 'Z' { + tr = tr + 'a' - 'A' + } + if sr != tr { + return false + } + } + return s == t +} + +// tokenListContainsValue returns true if the 1#token header with the given +// name contains a token equal to value with ASCII case folding. +func tokenListContainsValue(header http.Header, name string, value string) bool { +headers: + for _, s := range header[name] { + for { + var t string + t, s = nextToken(skipSpace(s)) + if t == "" { + continue headers + } + s = skipSpace(s) + if s != "" && s[0] != ',' { + continue headers + } + if equalASCIIFold(t, value) { + return true + } + if s == "" { + continue headers + } + s = s[1:] + } + } + return false +} + +// parseExtensions parses WebSocket extensions from a header. +func parseExtensions(header http.Header) []map[string]string { + // From RFC 6455: + // + // Sec-WebSocket-Extensions = extension-list + // extension-list = 1#extension + // extension = extension-token *( ";" extension-param ) + // extension-token = registered-token + // registered-token = token + // extension-param = token [ "=" (token | quoted-string) ] + // ;When using the quoted-string syntax variant, the value + // ;after quoted-string unescaping MUST conform to the + // ;'token' ABNF. + + var result []map[string]string +headers: + for _, s := range header["Sec-Websocket-Extensions"] { + for { + var t string + t, s = nextToken(skipSpace(s)) + if t == "" { + continue headers + } + ext := map[string]string{"": t} + for { + s = skipSpace(s) + if !strings.HasPrefix(s, ";") { + break + } + var k string + k, s = nextToken(skipSpace(s[1:])) + if k == "" { + continue headers + } + s = skipSpace(s) + var v string + if strings.HasPrefix(s, "=") { + v, s = nextTokenOrQuoted(skipSpace(s[1:])) + s = skipSpace(s) + } + if s != "" && s[0] != ',' && s[0] != ';' { + continue headers + } + ext[k] = v + } + if s != "" && s[0] != ',' { + continue headers + } + result = append(result, ext) + if s == "" { + continue headers + } + s = s[1:] + } + } + return result +} diff --git a/vendor/github.com/gorilla/websocket/x_net_proxy.go b/vendor/github.com/gorilla/websocket/x_net_proxy.go @@ -0,0 +1,473 @@ +// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT. +//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy + +// Package proxy provides support for a variety of protocols to proxy network +// data. +// + +package websocket + +import ( + "errors" + "io" + "net" + "net/url" + "os" + "strconv" + "strings" + "sync" +) + +type proxy_direct struct{} + +// Direct is a direct proxy: one that makes network connections directly. +var proxy_Direct = proxy_direct{} + +func (proxy_direct) Dial(network, addr string) (net.Conn, error) { + return net.Dial(network, addr) +} + +// A PerHost directs connections to a default Dialer unless the host name +// requested matches one of a number of exceptions. +type proxy_PerHost struct { + def, bypass proxy_Dialer + + bypassNetworks []*net.IPNet + bypassIPs []net.IP + bypassZones []string + bypassHosts []string +} + +// NewPerHost returns a PerHost Dialer that directs connections to either +// defaultDialer or bypass, depending on whether the connection matches one of +// the configured rules. +func proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost { + return &proxy_PerHost{ + def: defaultDialer, + bypass: bypass, + } +} + +// Dial connects to the address addr on the given network through either +// defaultDialer or bypass. +func (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) { + host, _, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + + return p.dialerForRequest(host).Dial(network, addr) +} + +func (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer { + if ip := net.ParseIP(host); ip != nil { + for _, net := range p.bypassNetworks { + if net.Contains(ip) { + return p.bypass + } + } + for _, bypassIP := range p.bypassIPs { + if bypassIP.Equal(ip) { + return p.bypass + } + } + return p.def + } + + for _, zone := range p.bypassZones { + if strings.HasSuffix(host, zone) { + return p.bypass + } + if host == zone[1:] { + // For a zone ".example.com", we match "example.com" + // too. + return p.bypass + } + } + for _, bypassHost := range p.bypassHosts { + if bypassHost == host { + return p.bypass + } + } + return p.def +} + +// AddFromString parses a string that contains comma-separated values +// specifying hosts that should use the bypass proxy. Each value is either an +// IP address, a CIDR range, a zone (*.example.com) or a host name +// (localhost). A best effort is made to parse the string and errors are +// ignored. +func (p *proxy_PerHost) AddFromString(s string) { + hosts := strings.Split(s, ",") + for _, host := range hosts { + host = strings.TrimSpace(host) + if len(host) == 0 { + continue + } + if strings.Contains(host, "/") { + // We assume that it's a CIDR address like 127.0.0.0/8 + if _, net, err := net.ParseCIDR(host); err == nil { + p.AddNetwork(net) + } + continue + } + if ip := net.ParseIP(host); ip != nil { + p.AddIP(ip) + continue + } + if strings.HasPrefix(host, "*.") { + p.AddZone(host[1:]) + continue + } + p.AddHost(host) + } +} + +// AddIP specifies an IP address that will use the bypass proxy. Note that +// this will only take effect if a literal IP address is dialed. A connection +// to a named host will never match an IP. +func (p *proxy_PerHost) AddIP(ip net.IP) { + p.bypassIPs = append(p.bypassIPs, ip) +} + +// AddNetwork specifies an IP range that will use the bypass proxy. Note that +// this will only take effect if a literal IP address is dialed. A connection +// to a named host will never match. +func (p *proxy_PerHost) AddNetwork(net *net.IPNet) { + p.bypassNetworks = append(p.bypassNetworks, net) +} + +// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of +// "example.com" matches "example.com" and all of its subdomains. +func (p *proxy_PerHost) AddZone(zone string) { + if strings.HasSuffix(zone, ".") { + zone = zone[:len(zone)-1] + } + if !strings.HasPrefix(zone, ".") { + zone = "." + zone + } + p.bypassZones = append(p.bypassZones, zone) +} + +// AddHost specifies a host name that will use the bypass proxy. +func (p *proxy_PerHost) AddHost(host string) { + if strings.HasSuffix(host, ".") { + host = host[:len(host)-1] + } + p.bypassHosts = append(p.bypassHosts, host) +} + +// A Dialer is a means to establish a connection. +type proxy_Dialer interface { + // Dial connects to the given address via the proxy. + Dial(network, addr string) (c net.Conn, err error) +} + +// Auth contains authentication parameters that specific Dialers may require. +type proxy_Auth struct { + User, Password string +} + +// FromEnvironment returns the dialer specified by the proxy related variables in +// the environment. +func proxy_FromEnvironment() proxy_Dialer { + allProxy := proxy_allProxyEnv.Get() + if len(allProxy) == 0 { + return proxy_Direct + } + + proxyURL, err := url.Parse(allProxy) + if err != nil { + return proxy_Direct + } + proxy, err := proxy_FromURL(proxyURL, proxy_Direct) + if err != nil { + return proxy_Direct + } + + noProxy := proxy_noProxyEnv.Get() + if len(noProxy) == 0 { + return proxy + } + + perHost := proxy_NewPerHost(proxy, proxy_Direct) + perHost.AddFromString(noProxy) + return perHost +} + +// proxySchemes is a map from URL schemes to a function that creates a Dialer +// from a URL with such a scheme. +var proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error) + +// RegisterDialerType takes a URL scheme and a function to generate Dialers from +// a URL with that scheme and a forwarding Dialer. Registered schemes are used +// by FromURL. +func proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) { + if proxy_proxySchemes == nil { + proxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) + } + proxy_proxySchemes[scheme] = f +} + +// FromURL returns a Dialer given a URL specification and an underlying +// Dialer for it to make network requests. +func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) { + var auth *proxy_Auth + if u.User != nil { + auth = new(proxy_Auth) + auth.User = u.User.Username() + if p, ok := u.User.Password(); ok { + auth.Password = p + } + } + + switch u.Scheme { + case "socks5": + return proxy_SOCKS5("tcp", u.Host, auth, forward) + } + + // If the scheme doesn't match any of the built-in schemes, see if it + // was registered by another package. + if proxy_proxySchemes != nil { + if f, ok := proxy_proxySchemes[u.Scheme]; ok { + return f(u, forward) + } + } + + return nil, errors.New("proxy: unknown scheme: " + u.Scheme) +} + +var ( + proxy_allProxyEnv = &proxy_envOnce{ + names: []string{"ALL_PROXY", "all_proxy"}, + } + proxy_noProxyEnv = &proxy_envOnce{ + names: []string{"NO_PROXY", "no_proxy"}, + } +) + +// envOnce looks up an environment variable (optionally by multiple +// names) once. It mitigates expensive lookups on some platforms +// (e.g. Windows). +// (Borrowed from net/http/transport.go) +type proxy_envOnce struct { + names []string + once sync.Once + val string +} + +func (e *proxy_envOnce) Get() string { + e.once.Do(e.init) + return e.val +} + +func (e *proxy_envOnce) init() { + for _, n := range e.names { + e.val = os.Getenv(n) + if e.val != "" { + return + } + } +} + +// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address +// with an optional username and password. See RFC 1928 and RFC 1929. +func proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) { + s := &proxy_socks5{ + network: network, + addr: addr, + forward: forward, + } + if auth != nil { + s.user = auth.User + s.password = auth.Password + } + + return s, nil +} + +type proxy_socks5 struct { + user, password string + network, addr string + forward proxy_Dialer +} + +const proxy_socks5Version = 5 + +const ( + proxy_socks5AuthNone = 0 + proxy_socks5AuthPassword = 2 +) + +const proxy_socks5Connect = 1 + +const ( + proxy_socks5IP4 = 1 + proxy_socks5Domain = 3 + proxy_socks5IP6 = 4 +) + +var proxy_socks5Errors = []string{ + "", + "general failure", + "connection forbidden", + "network unreachable", + "host unreachable", + "connection refused", + "TTL expired", + "command not supported", + "address type not supported", +} + +// Dial connects to the address addr on the given network via the SOCKS5 proxy. +func (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) { + switch network { + case "tcp", "tcp6", "tcp4": + default: + return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network) + } + + conn, err := s.forward.Dial(s.network, s.addr) + if err != nil { + return nil, err + } + if err := s.connect(conn, addr); err != nil { + conn.Close() + return nil, err + } + return conn, nil +} + +// connect takes an existing connection to a socks5 proxy server, +// and commands the server to extend that connection to target, +// which must be a canonical address with a host and port. +func (s *proxy_socks5) connect(conn net.Conn, target string) error { + host, portStr, err := net.SplitHostPort(target) + if err != nil { + return err + } + + port, err := strconv.Atoi(portStr) + if err != nil { + return errors.New("proxy: failed to parse port number: " + portStr) + } + if port < 1 || port > 0xffff { + return errors.New("proxy: port number out of range: " + portStr) + } + + // the size here is just an estimate + buf := make([]byte, 0, 6+len(host)) + + buf = append(buf, proxy_socks5Version) + if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 { + buf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword) + } else { + buf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone) + } + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + if buf[0] != 5 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) + } + if buf[1] == 0xff { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") + } + + // See RFC 1929 + if buf[1] == proxy_socks5AuthPassword { + buf = buf[:0] + buf = append(buf, 1 /* password protocol version */) + buf = append(buf, uint8(len(s.user))) + buf = append(buf, s.user...) + buf = append(buf, uint8(len(s.password))) + buf = append(buf, s.password...) + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if buf[1] != 0 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") + } + } + + buf = buf[:0] + buf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */) + + if ip := net.ParseIP(host); ip != nil { + if ip4 := ip.To4(); ip4 != nil { + buf = append(buf, proxy_socks5IP4) + ip = ip4 + } else { + buf = append(buf, proxy_socks5IP6) + } + buf = append(buf, ip...) + } else { + if len(host) > 255 { + return errors.New("proxy: destination host name too long: " + host) + } + buf = append(buf, proxy_socks5Domain) + buf = append(buf, byte(len(host))) + buf = append(buf, host...) + } + buf = append(buf, byte(port>>8), byte(port)) + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:4]); err != nil { + return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + failure := "unknown error" + if int(buf[1]) < len(proxy_socks5Errors) { + failure = proxy_socks5Errors[buf[1]] + } + + if len(failure) > 0 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) + } + + bytesToDiscard := 0 + switch buf[3] { + case proxy_socks5IP4: + bytesToDiscard = net.IPv4len + case proxy_socks5IP6: + bytesToDiscard = net.IPv6len + case proxy_socks5Domain: + _, err := io.ReadFull(conn, buf[:1]) + if err != nil { + return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + bytesToDiscard = int(buf[0]) + default: + return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) + } + + if cap(buf) < bytesToDiscard { + buf = make([]byte, bytesToDiscard) + } else { + buf = buf[:bytesToDiscard] + } + if _, err := io.ReadFull(conn, buf); err != nil { + return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + // Also need to discard the port number + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + return nil +} diff --git a/vendor/github.com/nu7hatch/gouuid/.gitignore b/vendor/github.com/nu7hatch/gouuid/.gitignore @@ -0,0 +1,11 @@ +_obj +_test +*.6 +*.out +_testmain.go +\#* +.\#* +*.log +_cgo* +*.o +*.a diff --git a/vendor/github.com/nu7hatch/gouuid/COPYING b/vendor/github.com/nu7hatch/gouuid/COPYING @@ -0,0 +1,19 @@ +Copyright (C) 2011 by Krzysztof Kowalik <[email protected]> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +\ No newline at end of file diff --git a/vendor/github.com/nu7hatch/gouuid/README.md b/vendor/github.com/nu7hatch/gouuid/README.md @@ -0,0 +1,21 @@ +# Pure Go UUID implementation + +This package provides immutable UUID structs and the functions +NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 +and 5 UUIDs as specified in [RFC 4122](http://www.ietf.org/rfc/rfc4122.txt). + +## Installation + +Use the `go` tool: + + $ go get github.com/nu7hatch/gouuid + +## Usage + +See [documentation and examples](http://godoc.org/github.com/nu7hatch/gouuid) +for more information. + +## Copyright + +Copyright (C) 2011 by Krzysztof Kowalik <[email protected]>. See [COPYING](https://github.com/nu7hatch/gouuid/tree/master/COPYING) +file for details. diff --git a/vendor/github.com/nu7hatch/gouuid/uuid.go b/vendor/github.com/nu7hatch/gouuid/uuid.go @@ -0,0 +1,173 @@ +// This package provides immutable UUID structs and the functions +// NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 +// and 5 UUIDs as specified in RFC 4122. +// +// Copyright (C) 2011 by Krzysztof Kowalik <[email protected]> +package uuid + +import ( + "crypto/md5" + "crypto/rand" + "crypto/sha1" + "encoding/hex" + "errors" + "fmt" + "hash" + "regexp" +) + +// The UUID reserved variants. +const ( + ReservedNCS byte = 0x80 + ReservedRFC4122 byte = 0x40 + ReservedMicrosoft byte = 0x20 + ReservedFuture byte = 0x00 +) + +// The following standard UUIDs are for use with NewV3() or NewV5(). +var ( + NamespaceDNS, _ = ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NamespaceURL, _ = ParseHex("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NamespaceOID, _ = ParseHex("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NamespaceX500, _ = ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +) + +// Pattern used to parse hex string representation of the UUID. +// FIXME: do something to consider both brackets at one time, +// current one allows to parse string with only one opening +// or closing bracket. +const hexPattern = "^(urn\\:uuid\\:)?\\{?([a-z0-9]{8})-([a-z0-9]{4})-" + + "([1-5][a-z0-9]{3})-([a-z0-9]{4})-([a-z0-9]{12})\\}?$" + +var re = regexp.MustCompile(hexPattern) + +// A UUID representation compliant with specification in +// RFC 4122 document. +type UUID [16]byte + +// ParseHex creates a UUID object from given hex string +// representation. Function accepts UUID string in following +// formats: +// +// uuid.ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +// uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}") +// uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8") +// +func ParseHex(s string) (u *UUID, err error) { + md := re.FindStringSubmatch(s) + if md == nil { + err = errors.New("Invalid UUID string") + return + } + hash := md[2] + md[3] + md[4] + md[5] + md[6] + b, err := hex.DecodeString(hash) + if err != nil { + return + } + u = new(UUID) + copy(u[:], b) + return +} + +// Parse creates a UUID object from given bytes slice. +func Parse(b []byte) (u *UUID, err error) { + if len(b) != 16 { + err = errors.New("Given slice is not valid UUID sequence") + return + } + u = new(UUID) + copy(u[:], b) + return +} + +// Generate a UUID based on the MD5 hash of a namespace identifier +// and a name. +func NewV3(ns *UUID, name []byte) (u *UUID, err error) { + if ns == nil { + err = errors.New("Invalid namespace UUID") + return + } + u = new(UUID) + // Set all bits to MD5 hash generated from namespace and name. + u.setBytesFromHash(md5.New(), ns[:], name) + u.setVariant(ReservedRFC4122) + u.setVersion(3) + return +} + +// Generate a random UUID. +func NewV4() (u *UUID, err error) { + u = new(UUID) + // Set all bits to randomly (or pseudo-randomly) chosen values. + _, err = rand.Read(u[:]) + if err != nil { + return + } + u.setVariant(ReservedRFC4122) + u.setVersion(4) + return +} + +// Generate a UUID based on the SHA-1 hash of a namespace identifier +// and a name. +func NewV5(ns *UUID, name []byte) (u *UUID, err error) { + u = new(UUID) + // Set all bits to truncated SHA1 hash generated from namespace + // and name. + u.setBytesFromHash(sha1.New(), ns[:], name) + u.setVariant(ReservedRFC4122) + u.setVersion(5) + return +} + +// Generate a MD5 hash of a namespace and a name, and copy it to the +// UUID slice. +func (u *UUID) setBytesFromHash(hash hash.Hash, ns, name []byte) { + hash.Write(ns[:]) + hash.Write(name) + copy(u[:], hash.Sum([]byte{})[:16]) +} + +// Set the two most significant bits (bits 6 and 7) of the +// clock_seq_hi_and_reserved to zero and one, respectively. +func (u *UUID) setVariant(v byte) { + switch v { + case ReservedNCS: + u[8] = (u[8] | ReservedNCS) & 0xBF + case ReservedRFC4122: + u[8] = (u[8] | ReservedRFC4122) & 0x7F + case ReservedMicrosoft: + u[8] = (u[8] | ReservedMicrosoft) & 0x3F + } +} + +// Variant returns the UUID Variant, which determines the internal +// layout of the UUID. This will be one of the constants: RESERVED_NCS, +// RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE. +func (u *UUID) Variant() byte { + if u[8]&ReservedNCS == ReservedNCS { + return ReservedNCS + } else if u[8]&ReservedRFC4122 == ReservedRFC4122 { + return ReservedRFC4122 + } else if u[8]&ReservedMicrosoft == ReservedMicrosoft { + return ReservedMicrosoft + } + return ReservedFuture +} + +// Set the four most significant bits (bits 12 through 15) of the +// time_hi_and_version field to the 4-bit version number. +func (u *UUID) setVersion(v byte) { + u[6] = (u[6] & 0xF) | (v << 4) +} + +// Version returns a version number of the algorithm used to +// generate the UUID sequence. +func (u *UUID) Version() uint { + return uint(u[6] >> 4) +} + +// Returns unparsed version of the generated UUID sequence. +func (u *UUID) String() string { + return fmt.Sprintf("%x-%x-%x-%x-%x", u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) +} diff --git a/vendor/modules.txt b/vendor/modules.txt @@ -1,3 +1,27 @@ +# github.com/andreykaipov/goobs v0.6.0 +## explicit +github.com/andreykaipov/goobs +github.com/andreykaipov/goobs/api/events +github.com/andreykaipov/goobs/api/requests +github.com/andreykaipov/goobs/api/requests/general +github.com/andreykaipov/goobs/api/requests/media_control +github.com/andreykaipov/goobs/api/requests/outputs +github.com/andreykaipov/goobs/api/requests/profiles +github.com/andreykaipov/goobs/api/requests/recording +github.com/andreykaipov/goobs/api/requests/replay_buffer +github.com/andreykaipov/goobs/api/requests/scene_collections +github.com/andreykaipov/goobs/api/requests/scene_items +github.com/andreykaipov/goobs/api/requests/scenes +github.com/andreykaipov/goobs/api/requests/sources +github.com/andreykaipov/goobs/api/requests/streaming +github.com/andreykaipov/goobs/api/requests/studio_mode +github.com/andreykaipov/goobs/api/requests/transitions +github.com/andreykaipov/goobs/api/requests/virtual_cam +github.com/andreykaipov/goobs/api/typedefs +# github.com/gorilla/websocket v1.4.2 +github.com/gorilla/websocket +# github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d +github.com/nu7hatch/gouuid # golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 ## explicit golang.org/x/net/websocket