├── .gitattributes ├── .gitignore ├── PowerQueryConnectors.sln ├── README.md ├── build ├── DropBox.mez └── PowerShell.mez ├── media ├── DropBox128.png └── PowerShell128.png └── src ├── DropBox ├── DropBox.mproj ├── DropBox.png ├── DropBox.pq ├── DropBox.query.pq ├── DropBox16.png ├── DropBox20.png ├── DropBox24.png ├── DropBox32.png ├── DropBox40.png ├── DropBox48.png ├── DropBox64.png ├── DropBox80.png └── resources.resx ├── PowerShell ├── PowerShell.mproj ├── PowerShell.pq ├── PowerShell.query.pq ├── PowerShell16.png ├── PowerShell20.png ├── PowerShell24.png ├── PowerShell32.png ├── PowerShell40.png ├── PowerShell48.png ├── PowerShell64.png ├── PowerShell80.png ├── README.md └── resources.resx └── TPLinkSmartPlug ├── TPLinkSmartPlug.mproj ├── TPLinkSmartPlug.pq ├── TPLinkSmartPlug.query.pq ├── TPLinkSmartPlug16.png ├── TPLinkSmartPlug20.png ├── TPLinkSmartPlug24.png ├── TPLinkSmartPlug32.png ├── TPLinkSmartPlug40.png ├── TPLinkSmartPlug48.png ├── TPLinkSmartPlug64.png ├── TPLinkSmartPlug80.png └── resources.resx /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /PowerQueryConnectors.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.16 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{4DF76451-A46A-4C0B-BE03-459FAAFA07E6}") = "DropBox", "src\DropBox\DropBox.mproj", "{D4FAC38F-8819-4EF8-925B-DCAA7BEC7EC8}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FBD1B4C8-F9CB-4BE9-9873-D31FB8F69613}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Project("{4DF76451-A46A-4C0B-BE03-459FAAFA07E6}") = "PowerShell", "src\PowerShell\PowerShell.mproj", "{B07A6B44-66FC-4066-A45A-DEE1C14D2FC2}" 14 | EndProject 15 | Project("{4DF76451-A46A-4C0B-BE03-459FAAFA07E6}") = "TPLinkSmartPlug", "src\TPLinkSmartPlug\TPLinkSmartPlug.mproj", "{3AD9CC40-B62B-4F9D-9E8D-81B4847BE17E}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|x86 = Debug|x86 20 | Release|x86 = Release|x86 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {D4FAC38F-8819-4EF8-925B-DCAA7BEC7EC8}.Debug|x86.ActiveCfg = Debug|x86 24 | {D4FAC38F-8819-4EF8-925B-DCAA7BEC7EC8}.Debug|x86.Build.0 = Debug|x86 25 | {D4FAC38F-8819-4EF8-925B-DCAA7BEC7EC8}.Release|x86.ActiveCfg = Release|x86 26 | {D4FAC38F-8819-4EF8-925B-DCAA7BEC7EC8}.Release|x86.Build.0 = Release|x86 27 | {B07A6B44-66FC-4066-A45A-DEE1C14D2FC2}.Debug|x86.ActiveCfg = Debug|x86 28 | {B07A6B44-66FC-4066-A45A-DEE1C14D2FC2}.Debug|x86.Build.0 = Debug|x86 29 | {B07A6B44-66FC-4066-A45A-DEE1C14D2FC2}.Release|x86.ActiveCfg = Release|x86 30 | {B07A6B44-66FC-4066-A45A-DEE1C14D2FC2}.Release|x86.Build.0 = Release|x86 31 | {3AD9CC40-B62B-4F9D-9E8D-81B4847BE17E}.Debug|x86.ActiveCfg = Debug|x86 32 | {3AD9CC40-B62B-4F9D-9E8D-81B4847BE17E}.Debug|x86.Build.0 = Debug|x86 33 | {3AD9CC40-B62B-4F9D-9E8D-81B4847BE17E}.Release|x86.ActiveCfg = Release|x86 34 | {3AD9CC40-B62B-4F9D-9E8D-81B4847BE17E}.Release|x86.Build.0 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {06350C62-3DE8-4D0B-BCAD-376FDCA66C60} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/README.md -------------------------------------------------------------------------------- /build/DropBox.mez: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/build/DropBox.mez -------------------------------------------------------------------------------- /build/PowerShell.mez: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/build/PowerShell.mez -------------------------------------------------------------------------------- /media/DropBox128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/media/DropBox128.png -------------------------------------------------------------------------------- /media/PowerShell128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/media/PowerShell128.png -------------------------------------------------------------------------------- /src/DropBox/DropBox.mproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | 2.0 5 | 6 | 7 | Exe 8 | MyRootNamespace 9 | MyAssemblyName 10 | False 11 | False 12 | False 13 | False 14 | False 15 | False 16 | False 17 | False 18 | False 19 | False 20 | 1000 21 | Yes 22 | DropBox 23 | 24 | 25 | false 26 | 27 | bin\Debug\ 28 | 29 | 30 | false 31 | ..\..\build\ 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Code 42 | 43 | 44 | Code 45 | 46 | 47 | Code 48 | 49 | 50 | Code 51 | 52 | 53 | Code 54 | 55 | 56 | Code 57 | 58 | 59 | Code 60 | 61 | 62 | Code 63 | 64 | 65 | Code 66 | 67 | 68 | Code 69 | 70 | 71 | Code 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/DropBox/DropBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox.png -------------------------------------------------------------------------------- /src/DropBox/DropBox.pq: -------------------------------------------------------------------------------- 1 | // This file contains your Data Connector logic 2 | section DropBox; 3 | 4 | appKey="fianhvd3kknjeke"; 5 | appSecret="9fckd26kf1myv0u"; 6 | redirectUrl = "https://preview.powerbi.com/views/oauthredirect.html"; 7 | 8 | windowWidth = 720; 9 | windowHeight = 1024; 10 | 11 | 12 | [DataSource.Kind="DropBox", Publish="DropBox.Publish"] 13 | shared DropBox.Contents = (path as text) => 14 | let 15 | key = Extension.CurrentCredential()[access_token], 16 | content = Web.Contents("https://api.dropboxapi.com/2/files/list_folder",[ 17 | Content = Json.FromValue([ 18 | path = path, 19 | recursive=false, 20 | include_media_info=false, 21 | include_deleted=false, 22 | include_has_explicit_shared_members=false]), 23 | Headers=[#"Content-type" = "application/json", #"Authorization" = "Bearer " & key]]), 24 | json=Json.Document(content), 25 | out = Table.FromRecords(json[entries]) 26 | in 27 | out; 28 | 29 | [DataSource.Kind="DropBox"] 30 | shared DropBox.File = (path as text) => 31 | let 32 | key = Extension.CurrentCredential()[access_token], 33 | content = Web.Contents("https://content.dropboxapi.com/2/files/download",[ 34 | Headers=[#"Dropbox-API-Arg"=Text.FromBinary(Json.FromValue([path=path])), 35 | #"Authorization" = "Bearer " & key]]), 36 | json=content 37 | in 38 | json; 39 | 40 | 41 | // Data Source Kind description 42 | DropBox = [ 43 | Authentication = [ 44 | OAuth = [ 45 | StartLogin = StartLogin, 46 | FinishLogin = FinishLogin, 47 | Label = Extension.LoadString("AuthenticationLabel") 48 | ] 49 | ], 50 | Label = Extension.LoadString("DataSourceLabel") 51 | ]; 52 | 53 | 54 | // Data Source UI publishing description 55 | DropBox.Publish = [ 56 | Beta = true, 57 | Category = "Other", 58 | ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") }, 59 | LearnMoreUrl = "https://powerbi.microsoft.com/", 60 | SourceImage = DropBox.Icons, 61 | SourceTypeImage = DropBox.Icons 62 | ]; 63 | 64 | DropBox.Icons = [ 65 | Icon16 = { Extension.Contents("DropBox16.png"), Extension.Contents("DropBox20.png"), Extension.Contents("DropBox24.png"), Extension.Contents("DropBox32.png") }, 66 | Icon32 = { Extension.Contents("DropBox32.png"), Extension.Contents("DropBox40.png"), Extension.Contents("DropBox48.png"), Extension.Contents("DropBox64.png") } 67 | ]; 68 | 69 | StartLogin = (resourceUrl, state, display) => 70 | let 71 | AuthorizeUrl = "https://www.dropbox.com/oauth2/authorize?" & Uri.BuildQueryString([ 72 | response_type = "code", 73 | client_id = appKey, 74 | state = state, 75 | redirect_uri = redirectUrl]) 76 | in 77 | [ 78 | LoginUri = AuthorizeUrl, 79 | CallbackUri = redirectUrl, 80 | WindowHeight = windowHeight, 81 | WindowWidth = windowWidth, 82 | Context = null 83 | ]; 84 | 85 | FinishLogin = (context, callbackUri, state) => 86 | let 87 | parts = Uri.Parts(callbackUri)[Query], 88 | result = if (Record.HasFields(parts, {"error", "error_description"})) then 89 | error Error.Record(parts[error], parts[error_description], parts) 90 | else 91 | TokenMethod(parts[code]) 92 | in 93 | result; 94 | 95 | TokenMethod = (code) => 96 | let 97 | response = Web.Contents("https://api.dropboxapi.com/oauth2/token", [ 98 | Content = Text.ToBinary(Uri.BuildQueryString([ 99 | grant_type = "authorization_code", 100 | client_id = appKey, 101 | client_secret = appSecret, 102 | code = code, 103 | redirect_uri = redirectUrl])), 104 | Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"], ManualStatusHandling = {400}]), 105 | body = Json.Document(response), 106 | result = if (Record.HasFields(body, {"error", "error_description"})) then 107 | error Error.Record(body[error], body[error_description], body) 108 | else 109 | body 110 | in 111 | result; 112 | 113 | Table.ToNavigationTable = ( 114 | table as table, 115 | keyColumns as list, 116 | nameColumn as text, 117 | dataColumn as text, 118 | itemKindColumn as text, 119 | itemNameColumn as text, 120 | isLeafColumn as text 121 | ) as table => 122 | let 123 | tableType = Value.Type(table), 124 | newTableType = Type.AddTableKey(tableType, keyColumns, true) meta 125 | [ 126 | NavigationTable.NameColumn = nameColumn, 127 | NavigationTable.DataColumn = dataColumn, 128 | NavigationTable.ItemKindColumn = itemKindColumn, 129 | Preview.DelayColumn = itemNameColumn, 130 | NavigationTable.IsLeafColumn = isLeafColumn 131 | ], 132 | navigationTable = Value.ReplaceType(table, newTableType) 133 | in 134 | navigationTable; 135 | 136 | -------------------------------------------------------------------------------- /src/DropBox/DropBox.query.pq: -------------------------------------------------------------------------------- 1 | // Use this file to write queries to test your data connector 2 | let 3 | result = DropBox.Contents("/home/Code") 4 | in 5 | result -------------------------------------------------------------------------------- /src/DropBox/DropBox16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox16.png -------------------------------------------------------------------------------- /src/DropBox/DropBox20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox20.png -------------------------------------------------------------------------------- /src/DropBox/DropBox24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox24.png -------------------------------------------------------------------------------- /src/DropBox/DropBox32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox32.png -------------------------------------------------------------------------------- /src/DropBox/DropBox40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox40.png -------------------------------------------------------------------------------- /src/DropBox/DropBox48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox48.png -------------------------------------------------------------------------------- /src/DropBox/DropBox64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox64.png -------------------------------------------------------------------------------- /src/DropBox/DropBox80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/DropBox/DropBox80.png -------------------------------------------------------------------------------- /src/DropBox/resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | DropBox Auth 122 | 123 | 124 | Connect to DropBox 125 | 126 | 127 | DropBox 128 | 129 | 130 | DropBox 131 | 132 | -------------------------------------------------------------------------------- /src/PowerShell/PowerShell.mproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | 2.0 5 | 6 | 7 | Exe 8 | MyRootNamespace 9 | MyAssemblyName 10 | False 11 | False 12 | False 13 | False 14 | False 15 | False 16 | False 17 | False 18 | False 19 | False 20 | 1000 21 | Yes 22 | PowerShell 23 | 24 | 25 | false 26 | 27 | bin\Debug\ 28 | 29 | 30 | false 31 | ..\..\build\ 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Code 42 | 43 | 44 | Code 45 | 46 | 47 | Code 48 | 49 | 50 | Code 51 | 52 | 53 | Code 54 | 55 | 56 | Code 57 | 58 | 59 | Code 60 | 61 | 62 | Code 63 | 64 | 65 | Code 66 | 67 | 68 | Code 69 | 70 | 71 | Code 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/PowerShell/PowerShell.pq: -------------------------------------------------------------------------------- 1 | // This file contains your Data Connector logic 2 | section PowerShell; 3 | 4 | [DataSource.Kind="PowerShell", Publish="PowerShell.Publish"] 5 | shared PowerShell.Execute = (filePath as text) => 6 | let 7 | folder = Text.BeforeDelimiter(filePath,"\", {0, RelativePosition.FromEnd}), 8 | file = Text.BetweenDelimiters(filePath,"\", ".", {0, RelativePosition.FromEnd}, 0), 9 | out = AdoDotNet.Query("System.Data.CData.PowerShell","ScriptLocation='"&folder&"';ExecuteQuery=True","select * from "&file) 10 | in 11 | out; 12 | 13 | // Data Source Kind description 14 | PowerShell = [ 15 | Authentication = [ 16 | Implicit = [] 17 | ], 18 | Label = Extension.LoadString("DataSourceLabel") 19 | ]; 20 | 21 | // Data Source UI publishing description 22 | PowerShell.Publish = [ 23 | Beta = true, 24 | Category = "Other", 25 | ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") }, 26 | LearnMoreUrl = "https://powerbi.microsoft.com/", 27 | SourceImage = PowerShell.Icons, 28 | SourceTypeImage = PowerShell.Icons 29 | ]; 30 | 31 | PowerShell.Icons = [ 32 | Icon16 = { Extension.Contents("PowerShell16.png"), Extension.Contents("PowerShell20.png"), Extension.Contents("PowerShell24.png"), Extension.Contents("PowerShell32.png") }, 33 | Icon32 = { Extension.Contents("PowerShell32.png"), Extension.Contents("PowerShell40.png"), Extension.Contents("PowerShell48.png"), Extension.Contents("PowerShell64.png") } 34 | ]; 35 | -------------------------------------------------------------------------------- /src/PowerShell/PowerShell.query.pq: -------------------------------------------------------------------------------- 1 | // Use this file to write queries to test your data connector 2 | let 3 | result = PowerShell.Execute("z:\connector\demo.ps1") 4 | in 5 | result -------------------------------------------------------------------------------- /src/PowerShell/PowerShell16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell16.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell20.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell24.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell32.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell40.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell48.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell64.png -------------------------------------------------------------------------------- /src/PowerShell/PowerShell80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/PowerShell/PowerShell80.png -------------------------------------------------------------------------------- /src/PowerShell/README.md: -------------------------------------------------------------------------------- 1 | ## PowerShell connector 2 | 3 | Has a dependency on [CData ADO.NET Provider for PowerShell](http://www.cdata.com/drivers/powershell/ado/) 4 | 5 | In order to run the connector use the `GetData > Other > PowerShell` dialog or the command: 6 | 7 | `= PowerShell.Execute("z:/path to/cmdlet.ps1")` 8 | 9 | The CData ADO.NET provider requires that the schema of the output be mentioned as a parameter at the start of the cmdlet. For example: 10 | 11 | ``` 12 | param( 13 | [String]$Name='', 14 | [String]$Description='', 15 | [String]$InvariantName='', 16 | [String]$AssemblyQualifiedName='') 17 | 18 | [System.Data.Common.DbProviderFactories]::GetFactoryClasses() 19 | 20 | ``` -------------------------------------------------------------------------------- /src/PowerShell/resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Connect to PowerShell 122 | 123 | 124 | PowerShell 125 | 126 | 127 | PowerShell 128 | 129 | -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug.mproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | 2.0 5 | 6 | 7 | Exe 8 | MyRootNamespace 9 | MyAssemblyName 10 | False 11 | False 12 | False 13 | False 14 | False 15 | False 16 | False 17 | False 18 | False 19 | False 20 | 1000 21 | Yes 22 | TPLinkSmartPlug 23 | 24 | 25 | false 26 | 27 | bin\Debug\ 28 | 29 | 30 | false 31 | bin\Release\ 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Code 42 | 43 | 44 | Code 45 | 46 | 47 | Code 48 | 49 | 50 | Code 51 | 52 | 53 | Code 54 | 55 | 56 | Code 57 | 58 | 59 | Code 60 | 61 | 62 | Code 63 | 64 | 65 | Code 66 | 67 | 68 | Code 69 | 70 | 71 | Code 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug.pq: -------------------------------------------------------------------------------- 1 | // Data connector for for the TP-Link HS-100 smart plug 2 | section TPLinkSmartPlug; 3 | //A GUID that represents this client 4 | GUID = "72fc1bfa-d102-42a3-a394-eb6687e3ed19"; 5 | 6 | [DataSource.Kind="TPLinkSmartPlug", Publish="TPLinkSmartPlug.Publish"] 7 | shared TPLinkSmartPlug.Devices = () => 8 | let 9 | credential = Extension.CurrentCredential(), 10 | payload = [ method= "login", 11 | params= [ 12 | appType= "Kasa_Android", 13 | cloudUserName=credential[Username], 14 | cloudPassword=credential[Password], 15 | terminalUUID= GUID 16 | ] 17 | ], 18 | tokenRequest = Web.Contents("https://wap.tplinkcloud.com", [Content=Json.FromValue(payload)]), 19 | token = Json.Document(tokenRequest)[result][token], 20 | devicesRequest = Web.Contents("https://wap.tplinkcloud.com",[Query=[token = token],Content = Json.FromValue([method="getDeviceList"])]), 21 | devicesList = Json.Document(devicesRequest)[result][deviceList]{0}, 22 | devicesTable = #table( 23 | {"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},{ 24 | {devicesList[alias],devicesList[deviceId], TPLinkSmartPlug.DeviceInfo(devicesList[deviceId]), "Table", "Table", true} 25 | }), 26 | devicesNavigation = Table.ToNavigationTable(devicesTable, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf") 27 | in 28 | devicesNavigation; 29 | 30 | TPLinkSmartPlug.DeviceInfo = (deviceId as text) => 31 | let 32 | credential = Extension.CurrentCredential(), 33 | payload = [ method= "login", 34 | params= [ 35 | appType= "Kasa_Android", 36 | cloudUserName=credential[Username], 37 | cloudPassword=credential[Password], 38 | terminalUUID= GUID 39 | ] 40 | ], 41 | tokenRequest = Web.Contents("https://wap.tplinkcloud.com", [Content=Json.FromValue(payload)]), 42 | token = Json.Document(tokenRequest)[result][token], 43 | statsPayload = [ method="passthrough", 44 | params=[ deviceId=deviceId, 45 | requestData=Json.FromValue([system=[get_sysinfo="null"]]) 46 | ] 47 | ], 48 | statsRequest = Web.Contents("https://wap.tplinkcloud.com",[Query=[token = token],Content = Json.FromValue(statsPayload)]), 49 | statsResponse = Json.Document(Json.Document(statsRequest)[result][responseData])[system], 50 | stats = if statsResponse[get_sysinfo]?=null then Record.ToTable(statsResponse) else Record.ToTable(statsResponse[get_sysinfo]) 51 | in 52 | stats; 53 | 54 | // Data Source Kind description 55 | TPLinkSmartPlug = [ 56 | Authentication = [ 57 | // Key = [], 58 | UsernamePassword = [] 59 | // Windows = [], 60 | //Implicit = [] 61 | ], 62 | Label = Extension.LoadString("DataSourceLabel") 63 | ]; 64 | 65 | // Data Source UI publishing description 66 | TPLinkSmartPlug.Publish = [ 67 | Beta = true, 68 | Category = "Other", 69 | ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") }, 70 | LearnMoreUrl = "https://powerbi.microsoft.com/", 71 | SourceImage = TPLinkSmartPlug.Icons, 72 | SourceTypeImage = TPLinkSmartPlug.Icons 73 | ]; 74 | 75 | TPLinkSmartPlug.Icons = [ 76 | Icon16 = { Extension.Contents("TPLinkSmartPlug16.png"), Extension.Contents("TPLinkSmartPlug20.png"), Extension.Contents("TPLinkSmartPlug24.png"), Extension.Contents("TPLinkSmartPlug32.png") }, 77 | Icon32 = { Extension.Contents("TPLinkSmartPlug32.png"), Extension.Contents("TPLinkSmartPlug40.png"), Extension.Contents("TPLinkSmartPlug48.png"), Extension.Contents("TPLinkSmartPlug64.png") } 78 | ]; 79 | 80 | 81 | Table.ToNavigationTable = ( 82 | table as table, 83 | keyColumns as list, 84 | nameColumn as text, 85 | dataColumn as text, 86 | itemKindColumn as text, 87 | itemNameColumn as text, 88 | isLeafColumn as text 89 | ) as table => 90 | let 91 | tableType = Value.Type(table), 92 | newTableType = Type.AddTableKey(tableType, keyColumns, true) meta 93 | [ 94 | NavigationTable.NameColumn = nameColumn, 95 | NavigationTable.DataColumn = dataColumn, 96 | NavigationTable.ItemKindColumn = itemKindColumn, 97 | Preview.DelayColumn = itemNameColumn, 98 | NavigationTable.IsLeafColumn = isLeafColumn 99 | ], 100 | navigationTable = Value.ReplaceType(table, newTableType) 101 | in 102 | navigationTable; -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug.query.pq: -------------------------------------------------------------------------------- 1 | // Use this file to write queries to test your data connector 2 | let 3 | result = TPLinkSmartPlug.Devices() 4 | in 5 | result -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug16.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug20.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug24.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug32.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug40.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug48.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug64.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/TPLinkSmartPlug80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hugoberry/PowerQueryConnectors/8dd994939961c79edd897ab306ea5f4da3ce081a/src/TPLinkSmartPlug/TPLinkSmartPlug80.png -------------------------------------------------------------------------------- /src/TPLinkSmartPlug/resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Connect to TPLinkSmartPlug 122 | 123 | 124 | TPLinkSmartPlug 125 | 126 | 127 | TPLinkSmartPlug 128 | 129 | --------------------------------------------------------------------------------