├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── Tools
├── 7-zip
│ ├── 7-zip.chm
│ ├── 7za.exe
│ ├── copying.txt
│ ├── license.txt
│ └── readme.txt
├── Kvm
│ ├── kvm.cmd
│ └── kvm.ps1
├── NUnit
│ ├── framework
│ │ ├── nunit.framework.dll
│ │ ├── nunit.framework.xml
│ │ ├── nunit.mocks.dll
│ │ └── pnunit.framework.dll
│ ├── lib
│ │ ├── Images
│ │ │ ├── Ellipsis.gif
│ │ │ ├── Tree
│ │ │ │ ├── Circles
│ │ │ │ │ ├── Failure.jpg
│ │ │ │ │ ├── Ignored.jpg
│ │ │ │ │ ├── Inconclusive.jpg
│ │ │ │ │ ├── Skipped.jpg
│ │ │ │ │ └── Success.jpg
│ │ │ │ ├── Classic
│ │ │ │ │ ├── Failure.jpg
│ │ │ │ │ ├── Ignored.jpg
│ │ │ │ │ ├── Inconclusive.jpg
│ │ │ │ │ ├── Skipped.jpg
│ │ │ │ │ └── Success.jpg
│ │ │ │ ├── Default
│ │ │ │ │ ├── Failure.png
│ │ │ │ │ ├── Ignored.png
│ │ │ │ │ ├── Inconclusive.png
│ │ │ │ │ ├── Skipped.png
│ │ │ │ │ └── Success.png
│ │ │ │ └── Visual Studio
│ │ │ │ │ ├── Failure.png
│ │ │ │ │ ├── Ignored.png
│ │ │ │ │ ├── Inconclusive.png
│ │ │ │ │ ├── SeriousWarning.png
│ │ │ │ │ ├── Skipped.png
│ │ │ │ │ └── Success.png
│ │ │ ├── pinned.gif
│ │ │ └── unpinned.gif
│ │ ├── NSubstitute.dll
│ │ ├── NSubstitute.xml
│ │ ├── Rhino.Mocks.dll
│ │ ├── Rhino.Mocks.xml
│ │ ├── log4net.dll
│ │ ├── nunit-console-runner.dll
│ │ ├── nunit-gui-runner.dll
│ │ ├── nunit.core.dll
│ │ ├── nunit.core.interfaces.dll
│ │ ├── nunit.uiexception.dll
│ │ ├── nunit.uikit.dll
│ │ └── nunit.util.dll
│ ├── nunit-agent-x86.exe
│ ├── nunit-agent-x86.exe.config
│ ├── nunit-agent.exe
│ ├── nunit-agent.exe.config
│ ├── nunit-console-x86.exe
│ ├── nunit-console-x86.exe.config
│ ├── nunit-console.exe
│ ├── nunit-console.exe.config
│ ├── nunit-x86.exe
│ ├── nunit-x86.exe.config
│ ├── nunit.exe
│ └── nunit.exe.config
├── NuGet
│ ├── NuGet.exe
│ └── NuGet.targets
└── PSake
│ └── psake.psm1
├── build
├── DropboxRestAPI.nuspec
├── build.ps1
├── runbuild.cmd
└── runbuild.ps1
└── src
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── DropboxRestAPI.Portable.sln
├── DropboxRestAPI.sln
├── DropboxRestAPI
├── AutoRetryRequestExecuter.cs
├── Client.cs
├── DropboxRestAPI.Portable.csproj
├── DropboxRestAPI.csproj
├── Http
│ ├── AccessTokenAuthenticator.cs
│ ├── HttpClientFactory.cs
│ ├── HttpClientOptions.cs
│ ├── IHttpClientFactory.cs
│ └── ThrottlingMessageHandler.cs
├── IClient.cs
├── IRequestExecuter.cs
├── LargeFileUploader.cs
├── Models
│ ├── Business
│ │ ├── ActivityInfo.cs
│ │ ├── DevicesInfo.cs
│ │ ├── Event.cs
│ │ ├── EventInfo.cs
│ │ ├── Events.cs
│ │ ├── GroupInfo.cs
│ │ ├── GroupMember.cs
│ │ ├── GroupsInfo.cs
│ │ ├── MemberInfo.cs
│ │ ├── MemberPermissions.cs
│ │ ├── MemberProfile.cs
│ │ ├── Members.cs
│ │ ├── MembershipInfo.cs
│ │ ├── PermissionInfo.cs
│ │ ├── StorageInfo.cs
│ │ └── TeamInfo.cs
│ ├── Core
│ │ ├── AccountInfo.cs
│ │ ├── AccountTeam.cs
│ │ ├── ChunkedUpload.cs
│ │ ├── CopyRef.cs
│ │ ├── DeltaCursor.cs
│ │ ├── Entries.cs
│ │ ├── Group.cs
│ │ ├── Groups.cs
│ │ ├── LongpollDelta.cs
│ │ ├── MediaLink.cs
│ │ ├── Membership.cs
│ │ ├── MetaData.cs
│ │ ├── NameDetails.cs
│ │ ├── Owner.cs
│ │ ├── PhotoInfo.cs
│ │ ├── Preview.cs
│ │ ├── QuotaInfo.cs
│ │ ├── SaveUrl.cs
│ │ ├── SaveUrlJob.cs
│ │ ├── SaveUrlStatus.cs
│ │ ├── SharedFolder.cs
│ │ ├── SharedLink.cs
│ │ ├── Token.cs
│ │ ├── User.cs
│ │ └── VideoInfo.cs
│ ├── Error.cs
│ └── Exceptions
│ │ ├── NotEnoughQuotaException.cs
│ │ ├── RetryLaterException.cs
│ │ └── ServiceErrorException.cs
├── Options.cs
├── Properties
│ └── AssemblyInfo.cs
├── RequestExecuter.cs
├── RequestsGenerators
│ ├── Business
│ │ ├── AuditLogRequestGenerator.cs
│ │ ├── BusinessRequestGenerator.cs
│ │ ├── GroupsRequestGenerator.cs
│ │ ├── IAuditLogRequestGenerator.cs
│ │ ├── IBusinessRequestGenerator.cs
│ │ ├── IGroupsRequestGenerator.cs
│ │ ├── IReportsRequestGenerator.cs
│ │ ├── ITeamInfoRequestGenerator.cs
│ │ ├── ITeamMembersRequestGenerator.cs
│ │ ├── ReportsRequestGenerator.cs
│ │ ├── TeamInfoRequestGenerator.cs
│ │ └── TeamMembersRequestGenerator.cs
│ ├── Consts.cs
│ ├── Core
│ │ ├── AccountsRequestGenerator.cs
│ │ ├── CoreRequestGenerator.cs
│ │ ├── FileOperationsRequestGenerator.cs
│ │ ├── IAccountsRequestGenerator.cs
│ │ ├── ICoreRequestGenerator.cs
│ │ ├── IFileOperationsRequestGenerator.cs
│ │ ├── IMetadataRequestGenerator.cs
│ │ ├── IOAuth2RequestGenerator.cs
│ │ ├── MetadataRequestGenerator.cs
│ │ └── OAuthRequestGenerator.cs
│ ├── IRequestGenerator.cs
│ └── RequestGenerator.cs
├── Services
│ ├── Business
│ │ ├── AuditLog.cs
│ │ ├── Business.cs
│ │ ├── Groups.cs
│ │ ├── IAuditLog.cs
│ │ ├── IBusiness.cs
│ │ ├── IGroups.cs
│ │ ├── IInfo.cs
│ │ ├── IMembers.cs
│ │ ├── IReports.cs
│ │ ├── Info.cs
│ │ ├── Members.cs
│ │ └── Reports.cs
│ └── Core
│ │ ├── Accounts.cs
│ │ ├── Core.cs
│ │ ├── FileOperations.cs
│ │ ├── IAccounts.cs
│ │ ├── ICore.cs
│ │ ├── IFileOperations.cs
│ │ ├── IMetadata.cs
│ │ ├── IOAuth2.cs
│ │ ├── Metadata.cs
│ │ └── OAuth2.cs
├── Utils
│ ├── DateTimeUtils.cs
│ ├── HttpClientExtensions.cs
│ ├── HttpException.cs
│ ├── HttpUtility.cs
│ ├── HttpValue.cs
│ ├── HttpValueCollection.cs
│ ├── JsonContent.cs
│ ├── Request.cs
│ ├── TimeSpanSemaphore.cs
│ ├── TupleStringMetadataConverter.cs
│ └── UnixEpochDateTimeConverter.cs
└── packages.config
├── NuGet.Config
├── Sample.sln
├── Sample
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── Sample.csproj
└── packages
└── repositories.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.doc diff=astextplain
2 | *.DOC diff=astextplain
3 | *.docx diff=astextplain
4 | *.DOCX diff=astextplain
5 | *.dot diff=astextplain
6 | *.DOT diff=astextplain
7 | *.pdf diff=astextplain
8 | *.PDF diff=astextplain
9 | *.rtf diff=astextplain
10 | *.RTF diff=astextplain
11 |
12 | *.jpg binary
13 | *.png binary
14 | *.gif binary
15 | *.bson binary
16 |
17 | *.cs text diff=csharp
18 | *.vb text
19 | *.c text
20 | *.cpp text
21 | *.cxx text
22 | *.h text
23 | *.hxx text
24 | *.py text
25 | *.rb text
26 | *.java text
27 | *.html text
28 | *.htm text
29 | *.css text
30 | *.scss text
31 | *.sass text
32 | *.less text
33 | *.js text
34 | *.lisp text
35 | *.clj text
36 | *.sql text
37 | *.php text
38 | *.lua text
39 | *.m text
40 | *.asm text
41 | *.erl text
42 | *.fs text
43 | *.fsx text
44 | *.hs text
45 | *.ps1 text
46 | *.psm1 text
47 |
48 | *.csproj text merge=union
49 | *.vbproj text merge=union
50 | *.fsproj text merge=union
51 | *.dbproj text merge=union
52 | *.sln text eol=crlf merge=union
53 |
54 |
--------------------------------------------------------------------------------
/.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 | *.sln.docstates
8 | *.DotSettings
9 |
10 | # Build results
11 |
12 | [Dd]ebug/
13 | [Rr]elease/
14 | x64/
15 | [Bb]in/
16 | [Oo]bj/
17 | [Ww]orking/
18 | Build/runbuild.txt
19 |
20 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
21 | !packages/*/build/
22 |
23 | # MSTest test Results
24 | [Tt]est[Rr]esult*/
25 | [Bb]uild[Ll]og.*
26 |
27 | *_i.c
28 | *_p.c
29 | *.ilk
30 | *.meta
31 | *.obj
32 | *.pch
33 | *.pdb
34 | *.pgc
35 | *.pgd
36 | *.rsp
37 | *.sbr
38 | *.tlb
39 | *.tli
40 | *.tlh
41 | *.tmp
42 | *.tmp_proj
43 | *.log
44 | *.vspscc
45 | *.vssscc
46 | .builds
47 | *.pidb
48 | *.log
49 | *.scc
50 |
51 | # Visual C++ cache files
52 | ipch/
53 | *.aps
54 | *.ncb
55 | *.opensdf
56 | *.sdf
57 | *.cachefile
58 |
59 | # Visual Studio profiler
60 | *.psess
61 | *.vsp
62 | *.vspx
63 |
64 | # Guidance Automation Toolkit
65 | *.gpState
66 |
67 | # ReSharper is a .NET coding add-in
68 | _ReSharper*/
69 | *.[Rr]e[Ss]harper
70 |
71 | # TeamCity is a build add-in
72 | _TeamCity*
73 |
74 | # DotCover is a Code Coverage Tool
75 | *.dotCover
76 |
77 | # NCrunch
78 | *.ncrunch*
79 | .*crunch*.local.xml
80 |
81 | # Installshield output folder
82 | [Ee]xpress/
83 |
84 | # DocProject is a documentation generator add-in
85 | DocProject/buildhelp/
86 | DocProject/Help/*.HxT
87 | DocProject/Help/*.HxC
88 | DocProject/Help/*.hhc
89 | DocProject/Help/*.hhk
90 | DocProject/Help/*.hhp
91 | DocProject/Help/Html2
92 | DocProject/Help/html
93 |
94 | # Click-Once directory
95 | publish/
96 |
97 | # Publish Web Output
98 | *.Publish.xml
99 |
100 | # NuGet Packages Directory
101 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
102 | #packages/
103 |
104 | # Windows Azure Build Output
105 | csx
106 | *.build.csdef
107 |
108 | # Windows Store app package directory
109 | AppPackages/
110 |
111 | # Others
112 | sql/
113 | *.Cache
114 | ClientBin/
115 | [Ss]tyle[Cc]op.*
116 | ~$*
117 | *~
118 | *.dbmdl
119 | *.[Pp]ublish.xml
120 | *.pfx
121 | *.publishsettings
122 |
123 | # RIA/Silverlight projects
124 | Generated_Code/
125 |
126 | # Backup & report files from converting an old project file to a newer
127 | # Visual Studio version. Backup files are not needed, because we have git ;-)
128 | _UpgradeReport_Files/
129 | Backup*/
130 | UpgradeLog*.XML
131 | UpgradeLog*.htm
132 |
133 |
134 | #LightSwitch generated files
135 | GeneratedArtifacts/
136 | _Pvt_Extensions/
137 | ModelManifest.xml
138 |
139 | # =========================
140 | # Windows detritus
141 | # =========================
142 |
143 | # Windows image file caches
144 | Thumbs.db
145 | ehthumbs.db
146 |
147 | # Folder config file
148 | Desktop.ini
149 |
150 | # Recycle Bin used on file shares
151 | $RECYCLE.BIN/
152 |
153 | # Mac desktop service store files
154 | .DS_Store
155 |
156 | #NuGet
157 | packages
158 | !packages/repositories.config
159 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Itay Sagui
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Tools/7-zip/7-zip.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/7-zip/7-zip.chm
--------------------------------------------------------------------------------
/Tools/7-zip/7za.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/7-zip/7za.exe
--------------------------------------------------------------------------------
/Tools/7-zip/license.txt:
--------------------------------------------------------------------------------
1 | 7-Zip Command line version
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~
3 | License for use and distribution
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 |
6 | 7-Zip Copyright (C) 1999-2009 Igor Pavlov.
7 |
8 | 7za.exe is distributed under the GNU LGPL license
9 |
10 | Notes:
11 | You can use 7-Zip on any computer, including a computer in a commercial
12 | organization. You don't need to register or pay for 7-Zip.
13 |
14 |
15 | GNU LGPL information
16 | --------------------
17 |
18 | This library is free software; you can redistribute it and/or
19 | modify it under the terms of the GNU Lesser General Public
20 | License as published by the Free Software Foundation; either
21 | version 2.1 of the License, or (at your option) any later version.
22 |
23 | This library is distributed in the hope that it will be useful,
24 | but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 | Lesser General Public License for more details.
27 |
28 | You should have received a copy of the GNU Lesser General Public
29 | License along with this library; if not, write to the Free Software
30 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 |
--------------------------------------------------------------------------------
/Tools/7-zip/readme.txt:
--------------------------------------------------------------------------------
1 | 7-Zip Command line version 4.65
2 | -------------------------------
3 |
4 | 7-Zip is a file archiver with high compression ratio.
5 | 7za.exe is a standalone command line version of 7-Zip.
6 |
7 | 7-Zip Copyright (C) 1999-2009 Igor Pavlov.
8 |
9 | Features of 7za.exe:
10 | - High compression ratio in new 7z format
11 | - Supported formats:
12 | - Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR
13 | - Unpacking only: Z
14 | - Highest compression ratio for ZIP and GZIP formats.
15 | - Fast compression and decompression
16 | - Strong AES-256 encryption in 7z and ZIP formats.
17 |
18 | 7za.exe is a free software distributed under the GNU LGPL.
19 | Read license.txt for more information.
20 |
21 | Source code of 7za.exe and 7-Zip can be found at
22 | http://www.7-zip.org/
23 |
24 | 7za.exe can work in Windows 95/98/ME/NT/2000/XP/2003/Vista.
25 |
26 | There is also port of 7za.exe for POSIX systems like Unix (Linux, Solaris, OpenBSD,
27 | FreeBSD, Cygwin, AIX, ...), MacOS X and BeOS:
28 |
29 | http://p7zip.sourceforge.net/
30 |
31 |
32 | This distributive packet contains the following files:
33 |
34 | 7za.exe - 7-Zip standalone command line version.
35 | readme.txt - This file.
36 | copying.txt - GNU LGPL license.
37 | license.txt - License information.
38 | 7-zip.chm - User's Manual in HTML Help format.
39 |
40 |
41 | ---
42 | End of document
43 |
--------------------------------------------------------------------------------
/Tools/Kvm/kvm.cmd:
--------------------------------------------------------------------------------
1 | @Echo off
2 |
3 | PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0kvm.ps1' %*"
4 |
5 | IF EXIST "%USERPROFILE%\.kre\run-once.cmd" (
6 | CALL "%USERPROFILE%\.kre\run-once.cmd"
7 | DEL "%USERPROFILE%\.kre\run-once.cmd"
8 | )
9 |
--------------------------------------------------------------------------------
/Tools/NUnit/framework/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/framework/nunit.framework.dll
--------------------------------------------------------------------------------
/Tools/NUnit/framework/nunit.mocks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/framework/nunit.mocks.dll
--------------------------------------------------------------------------------
/Tools/NUnit/framework/pnunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/framework/pnunit.framework.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Ellipsis.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Ellipsis.gif
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Circles/Failure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Circles/Failure.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Circles/Ignored.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Circles/Ignored.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Circles/Inconclusive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Circles/Inconclusive.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Circles/Skipped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Circles/Skipped.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Circles/Success.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Circles/Success.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Classic/Failure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Classic/Failure.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Classic/Ignored.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Classic/Ignored.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Classic/Inconclusive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Classic/Inconclusive.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Classic/Skipped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Classic/Skipped.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Classic/Success.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Classic/Success.jpg
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Default/Failure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Default/Failure.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Default/Ignored.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Default/Ignored.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Default/Inconclusive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Default/Inconclusive.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Default/Skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Default/Skipped.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Default/Success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Default/Success.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/Failure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/Failure.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/Ignored.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/Ignored.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/Inconclusive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/Inconclusive.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/SeriousWarning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/SeriousWarning.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/Skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/Skipped.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/Tree/Visual Studio/Success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/Tree/Visual Studio/Success.png
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/pinned.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/pinned.gif
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Images/unpinned.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Images/unpinned.gif
--------------------------------------------------------------------------------
/Tools/NUnit/lib/NSubstitute.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/NSubstitute.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/Rhino.Mocks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/Rhino.Mocks.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/log4net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/log4net.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit-console-runner.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit-console-runner.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit-gui-runner.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit-gui-runner.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit.core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit.core.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit.core.interfaces.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit.core.interfaces.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit.uiexception.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit.uiexception.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit.uikit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit.uikit.dll
--------------------------------------------------------------------------------
/Tools/NUnit/lib/nunit.util.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/lib/nunit.util.dll
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-agent-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit-agent-x86.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-agent-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-agent.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit-agent.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-agent.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-console-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit-console-x86.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-console-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-console.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit-console.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-console.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit-x86.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tools/NUnit/nunit.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NUnit/nunit.exe
--------------------------------------------------------------------------------
/Tools/NUnit/nunit.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tools/NuGet/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/Tools/NuGet/NuGet.exe
--------------------------------------------------------------------------------
/build/DropboxRestAPI.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DropboxRestAPI
5 | 1.2.1
6 | DropboxRestAPI
7 | DropboxRestAPI is a C# client for Dropbox service through its RESTful API.
8 | saguiitay
9 | en-US
10 | https://github.com/saguiitay/DropboxRestAPI
11 | https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/master/LICENSE
12 | Dropbox HttpClient REST
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/build/runbuild.cmd:
--------------------------------------------------------------------------------
1 | cls
2 | powershell -Command "& { [Console]::WindowWidth = 150; [Console]::WindowHeight = 50; Start-Transcript runbuild.txt; Import-Module ..\Tools\PSake\psake.psm1; Invoke-psake ..\Build\build.ps1 %*; Stop-Transcript; }"
3 |
4 | pause
--------------------------------------------------------------------------------
/build/runbuild.ps1:
--------------------------------------------------------------------------------
1 | cls
2 |
3 | Import-Module '..\Tools\PSake\psake.psm1'
4 | Invoke-psake '.\build.ps1' Test -framework 3.5
5 | Remove-Module psake
6 |
--------------------------------------------------------------------------------
/src/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/src/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/src/DropboxRestAPI.Portable.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropboxRestAPI.Portable", "DropboxRestAPI\DropboxRestAPI.Portable.csproj", "{05322FC4-C284-4650-8DCD-1EC9C9879DB9}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{56AB6601-F8E1-4388-AA3C-C0917DDF80F7}"
9 | ProjectSection(SolutionItems) = preProject
10 | .nuget\NuGet.Config = .nuget\NuGet.Config
11 | .nuget\NuGet.exe = .nuget\NuGet.exe
12 | .nuget\NuGet.targets = .nuget\NuGet.targets
13 | EndProjectSection
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {05322FC4-C284-4650-8DCD-1EC9C9879DB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {05322FC4-C284-4650-8DCD-1EC9C9879DB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {05322FC4-C284-4650-8DCD-1EC9C9879DB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {05322FC4-C284-4650-8DCD-1EC9C9879DB9}.Release|Any CPU.Build.0 = Release|Any CPU
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/src/DropboxRestAPI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropboxRestAPI", "DropboxRestAPI\DropboxRestAPI.csproj", "{FA69B792-FCFF-4CB1-8435-798112337306}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{A1563ED0-2609-4CB0-8BEB-E0B4485C2B9A}"
9 | ProjectSection(SolutionItems) = preProject
10 | .nuget\NuGet.Config = .nuget\NuGet.Config
11 | .nuget\NuGet.exe = .nuget\NuGet.exe
12 | .nuget\NuGet.targets = .nuget\NuGet.targets
13 | EndProjectSection
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {FA69B792-FCFF-4CB1-8435-798112337306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {FA69B792-FCFF-4CB1-8435-798112337306}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {FA69B792-FCFF-4CB1-8435-798112337306}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {FA69B792-FCFF-4CB1-8435-798112337306}.Release|Any CPU.Build.0 = Release|Any CPU
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/src/DropboxRestAPI/AutoRetryRequestExecuter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using DropboxRestAPI.Models.Exceptions;
6 | using DropboxRestAPI.Utils;
7 |
8 | namespace DropboxRestAPI
9 | {
10 | public class AutoRetryRequestExecuter : IRequestExecuter
11 | {
12 | private readonly IRequestExecuter _requestExecuter;
13 |
14 | public int NumberOfRetries { get; set; }
15 |
16 | public AutoRetryRequestExecuter(IRequestExecuter requestExecuter)
17 | {
18 | _requestExecuter = requestExecuter;
19 |
20 | NumberOfRetries = 3;
21 | }
22 |
23 | #region Implementation of IRequestExecuter
24 |
25 | public Task ExecuteAuthorization(IRequest restRequest, CancellationToken cancellationToken = default(CancellationToken)) where T : new()
26 | {
27 | return _requestExecuter.ExecuteAuthorization(restRequest, cancellationToken);
28 | }
29 |
30 | public async Task Execute(Func restRequest, HttpClient restClient = null, CancellationToken cancellationToken = default(CancellationToken))
31 | {
32 | for (int i = 0; i < NumberOfRetries; i++)
33 | {
34 | try
35 | {
36 | return await _requestExecuter.Execute(restRequest, restClient, cancellationToken).ConfigureAwait(false);
37 | }
38 | catch (RetryLaterException exception)
39 | {
40 | if (exception.RetryAfter != null)
41 | Task.Delay(TimeSpan.FromSeconds((int)exception.RetryAfter.Value), cancellationToken).Wait(cancellationToken);
42 | }
43 | }
44 |
45 | throw new RetryLaterException();
46 | }
47 |
48 | public async Task Execute(Func restRequest, HttpClient restClient = null, CancellationToken cancellationToken = default(CancellationToken))
49 | {
50 | for (int i = 0; i < NumberOfRetries; i++)
51 | {
52 | try
53 | {
54 | return await _requestExecuter.Execute(restRequest, restClient, cancellationToken).ConfigureAwait(false);
55 | }
56 | catch (RetryLaterException exception)
57 | {
58 | if (exception.RetryAfter != null)
59 | Task.Delay(TimeSpan.FromSeconds((int)exception.RetryAfter.Value), cancellationToken).Wait(cancellationToken);
60 | }
61 | }
62 |
63 | throw new RetryLaterException();
64 | }
65 |
66 | public Task CheckForError(HttpResponseMessage httpResponse, bool readResponse = true, CancellationToken cancellationToken = default(CancellationToken))
67 | {
68 | return _requestExecuter.CheckForError(httpResponse, readResponse, cancellationToken);
69 |
70 | }
71 |
72 | #endregion
73 | }
74 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Client.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Http;
27 | using DropboxRestAPI.RequestsGenerators;
28 | using DropboxRestAPI.Services.Business;
29 | using DropboxRestAPI.Services.Core;
30 |
31 | namespace DropboxRestAPI
32 | {
33 | public class Client : IClient
34 | {
35 | private readonly Options _options;
36 |
37 | public Client(Options options)
38 | : this(new HttpClientFactory(), new RequestGenerator(), options)
39 | {
40 | }
41 |
42 | public Client(IHttpClientFactory clientFactory, IRequestGenerator requestGenerator, Options options)
43 | {
44 | _options = options;
45 | IRequestExecuter requestExecuter = new RequestExecuter(
46 | clientFactory.CreateHttpClient(new HttpClientOptions
47 | {
48 | AddTokenToRequests = true,
49 | TokenRetriever = () => _options.AccessToken,
50 | ReadRequestsPerSecond = options.ReadRequestsPerSecond,
51 | WriteRequestsPerSecond = options.WriteRequestsPerSecond,
52 | }),
53 | clientFactory.CreateHttpClient(new HttpClientOptions()));
54 |
55 | if (options.AutoRetry)
56 | {
57 | requestExecuter = new AutoRetryRequestExecuter(requestExecuter)
58 | {
59 | NumberOfRetries = options.NumberOfRetries
60 | };
61 | }
62 |
63 | RequestGenerator = requestGenerator;
64 |
65 | Core = new Core(requestExecuter, requestGenerator.Core, options);
66 | Business = new Business(requestExecuter, requestGenerator);
67 | }
68 |
69 | public IRequestGenerator RequestGenerator { get; private set; }
70 |
71 | public string UserAccessToken
72 | {
73 | get { return _options.AccessToken; }
74 | set { _options.AccessToken = value; }
75 | }
76 |
77 | public ICore Core { get; private set; }
78 | public IBusiness Business { get; private set; }
79 | }
80 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Http/AccessTokenAuthenticator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using System.Net.Http;
28 | using System.Threading;
29 | using System.Threading.Tasks;
30 |
31 | namespace DropboxRestAPI.Http
32 | {
33 | public class AccessTokenAuthenticator : DelegatingHandler
34 | {
35 | private readonly Func _accessToken;
36 |
37 | public AccessTokenAuthenticator(Func accessToken, HttpMessageHandler innerHandler)
38 | : base(innerHandler)
39 | {
40 | _accessToken = accessToken;
41 | }
42 |
43 | #region Overrides of DelegatingHandler
44 |
45 | protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
46 | {
47 | string token = _accessToken();
48 | if (!string.IsNullOrWhiteSpace(token))
49 | {
50 | request.Headers.Add("Authorization", string.Format("Bearer {0}", token));
51 | }
52 |
53 | return base.SendAsync(request, cancellationToken);
54 | }
55 |
56 | #endregion
57 | }
58 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Http/HttpClientFactory.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using System.Net;
28 | using System.Net.Http;
29 | using DropboxRestAPI.Utils;
30 |
31 | namespace DropboxRestAPI.Http
32 | {
33 | public class HttpClientFactory : IHttpClientFactory
34 | {
35 | private TimeSpanSemaphore _readTimeSpanSemaphore;
36 | private TimeSpanSemaphore _writeTimeSpanSemaphore;
37 |
38 | public HttpClient CreateHttpClient(HttpClientOptions options)
39 | {
40 | HttpMessageHandler handler = new HttpClientHandler {AllowAutoRedirect = options.AllowAutoRedirect};
41 | if (((HttpClientHandler) handler).SupportsAutomaticDecompression)
42 | ((HttpClientHandler) handler).AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
43 |
44 | if (options.AddTokenToRequests)
45 | handler = new AccessTokenAuthenticator(options.TokenRetriever, handler);
46 |
47 | TimeSpanSemaphore readTimeSpanSemaphore = null;
48 | TimeSpanSemaphore writeTimeSpanSemaphore = null;
49 | if (options.ReadRequestsPerSecond.HasValue)
50 | {
51 | double delay = (1/options.ReadRequestsPerSecond.Value);
52 | readTimeSpanSemaphore = (_readTimeSpanSemaphore ?? (_readTimeSpanSemaphore = new TimeSpanSemaphore(1, TimeSpan.FromSeconds(delay))));
53 | }
54 | if (options.WriteRequestsPerSecond.HasValue)
55 | {
56 | double delay = (1/options.WriteRequestsPerSecond.Value);
57 | writeTimeSpanSemaphore = (_writeTimeSpanSemaphore ?? (_writeTimeSpanSemaphore = new TimeSpanSemaphore(1, TimeSpan.FromSeconds(delay))));
58 | }
59 |
60 | if (readTimeSpanSemaphore != null || writeTimeSpanSemaphore != null)
61 | {
62 | handler = new ThrottlingMessageHandler(readTimeSpanSemaphore, writeTimeSpanSemaphore, handler);
63 | }
64 | return new HttpClient(handler);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Http/HttpClientOptions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Http
29 | {
30 | public class HttpClientOptions
31 | {
32 | public bool AllowAutoRedirect { get; set; }
33 |
34 | public bool AddTokenToRequests { get; set; }
35 | public Func TokenRetriever { get; set; }
36 |
37 |
38 | public double? ReadRequestsPerSecond { get; set; }
39 | public double? WriteRequestsPerSecond { get; set; }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Http/IHttpClientFactory.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 |
28 | namespace DropboxRestAPI.Http
29 | {
30 | public interface IHttpClientFactory
31 | {
32 | HttpClient CreateHttpClient(HttpClientOptions options);
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Http/ThrottlingMessageHandler.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 | using System.Threading;
28 | using System.Threading.Tasks;
29 | using DropboxRestAPI.Utils;
30 |
31 | namespace DropboxRestAPI.Http
32 | {
33 | public class ThrottlingMessageHandler : DelegatingHandler
34 | {
35 | private readonly TimeSpanSemaphore _readTimeSpanSemaphore;
36 | private readonly TimeSpanSemaphore _writeTimeSpanSemaphore;
37 |
38 | public ThrottlingMessageHandler(TimeSpanSemaphore readTimeSpanSemaphore, TimeSpanSemaphore writeTimeSpanSemaphore)
39 | : this(readTimeSpanSemaphore, writeTimeSpanSemaphore, null)
40 | {
41 | }
42 |
43 | public ThrottlingMessageHandler(TimeSpanSemaphore readTimeSpanSemaphore, TimeSpanSemaphore writeTimeSpanSemaphore, HttpMessageHandler innerHandler)
44 | : base(innerHandler)
45 | {
46 | _readTimeSpanSemaphore = readTimeSpanSemaphore;
47 | _writeTimeSpanSemaphore = writeTimeSpanSemaphore;
48 | }
49 |
50 | protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
51 | {
52 | if (request.Method == HttpMethod.Get ||
53 | request.Method == HttpMethod.Head ||
54 | request.Method == HttpMethod.Options)
55 | {
56 | if (_readTimeSpanSemaphore != null)
57 | return _readTimeSpanSemaphore.RunAsync(base.SendAsync, request, cancellationToken);
58 |
59 | return base.SendAsync(request, cancellationToken);
60 | }
61 |
62 | if (_writeTimeSpanSemaphore != null)
63 | return _writeTimeSpanSemaphore.RunAsync(base.SendAsync, request, cancellationToken);
64 | return base.SendAsync(request, cancellationToken);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/IClient.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.RequestsGenerators;
27 | using DropboxRestAPI.Services.Business;
28 | using DropboxRestAPI.Services.Core;
29 |
30 | namespace DropboxRestAPI
31 | {
32 | public interface IClient
33 | {
34 | ///
35 | /// A token which can be used to make calls to the Dropbox API.
36 | ///
37 | /// This value is automatically updated when calling the Core.OAuth2.TokenAsync() method
38 | string UserAccessToken { get; set; }
39 |
40 | ///
41 | /// Helper class that generated requests to the Dropbox service
42 | ///
43 | IRequestGenerator RequestGenerator { get; }
44 |
45 | ///
46 | /// The Core API is the underlying interface for all of our official Dropbox mobile apps and our SDKs. It's the most
47 | /// direct way to access the API.
48 | ///
49 | ICore Core { get; }
50 |
51 | ///
52 | ///
53 | ///
54 | IBusiness Business { get; }
55 | }
56 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/IRequestExecuter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using DropboxRestAPI.Utils;
6 |
7 | namespace DropboxRestAPI
8 | {
9 | public interface IRequestExecuter
10 | {
11 | Task ExecuteAuthorization(IRequest restRequest, CancellationToken cancellationToken = default(CancellationToken)) where T : new();
12 |
13 | Task Execute(Func restRequest, HttpClient restClient = null, CancellationToken cancellationToken = default(CancellationToken));
14 |
15 | Task Execute(Func restRequest, HttpClient restClient = null, CancellationToken cancellationToken = default(CancellationToken));
16 |
17 | Task CheckForError(HttpResponseMessage httpResponse, bool readResponse = true, CancellationToken cancellationToken = default(CancellationToken));
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/LargeFileUploader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using DropboxRestAPI.Models.Core;
6 |
7 | namespace DropboxRestAPI
8 | {
9 | public class LargeFileUploader
10 | {
11 | public static long BufferSize = 4 * 1024 * 1024;
12 |
13 | private readonly Client _client;
14 | private readonly Stream _dataSource;
15 |
16 | public LargeFileUploader(Client client, Stream dataSource)
17 | {
18 | _client = client;
19 | _dataSource = dataSource;
20 | }
21 |
22 |
23 | public async Task UploadFileStream(string path, string locale = null, bool overwrite = true, string parent_rev = null, bool autorename = true, string asTeamMember = null,
24 | CancellationToken cancellationToken = default(CancellationToken))
25 | {
26 | string uploadId = null;
27 | long currentPosition = 0;
28 |
29 | var fragmentBuffer = new byte[BufferSize];
30 | do
31 | {
32 | long endPosition = currentPosition + BufferSize;
33 | if (endPosition > _dataSource.Length)
34 | {
35 | endPosition = _dataSource.Length;
36 | }
37 | var count = await _dataSource.ReadAsync(fragmentBuffer, 0, (int) Math.Max(0, endPosition - currentPosition), cancellationToken).ConfigureAwait(false);
38 |
39 | var response = await _client.Core.Metadata.ChunkedUploadAsync(fragmentBuffer, count, uploadId, currentPosition, asTeamMember, cancellationToken).ConfigureAwait(false);
40 | uploadId = response.upload_id;
41 |
42 | currentPosition = endPosition;
43 | } while (currentPosition < _dataSource.Length);
44 |
45 | if (uploadId == null)
46 | return null;
47 |
48 | var uploadedItem = await _client.Core.Metadata.CommitChunkedUploadAsync(path, uploadId, locale, overwrite, parent_rev, autorename, asTeamMember, cancellationToken).ConfigureAwait(false);
49 | return uploadedItem;
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/ActivityInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class ActivityInfo
29 | {
30 | public string start_date { get; set; }
31 | public long?[] active_users_1_day { get; set; }
32 | public long?[] active_users_7_day { get; set; }
33 | public long?[] active_users_28_day { get; set; }
34 | public long?[] adds { get; set; }
35 | public long?[] edits { get; set; }
36 | public long?[] deletes { get; set; }
37 | public long?[] active_shared_folders_1_day { get; set; }
38 | public long?[] active_shared_folders_7_day { get; set; }
39 | public long?[] active_shared_folders_28_day { get; set; }
40 | public long?[] shared_links_created { get; set; }
41 | public long?[] shared_links_viewed_total { get; set; }
42 | public long?[] shared_links_viewed_by_team { get; set; }
43 | public long?[] shared_links_viewed_by_outside_user { get; set; }
44 | public long?[] shared_links_viewed_by_not_logged_in { get; set; }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/DevicesInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class DevicesInfo
29 | {
30 | public string start_date { get; set; }
31 | public long?[] total_devices_1_day { get; set; }
32 | public long?[] total_devices_7_day { get; set; }
33 | public long?[] total_devices_28_day { get; set; }
34 | public long?[] ios_devices_1_day { get; set; }
35 | public long?[] ios_devices_7_day { get; set; }
36 | public long?[] ios_devices_28_day { get; set; }
37 | public long?[] android_devices_1_day { get; set; }
38 | public long?[] android_devices_7_day { get; set; }
39 | public long?[] android_devices_28_day { get; set; }
40 | public long?[] macos_devices_1_day { get; set; }
41 | public long?[] macos_devices_7_day { get; set; }
42 | public long?[] macos_devices_28_day { get; set; }
43 | public long?[] windows_devices_1_day { get; set; }
44 | public long?[] windows_devices_7_day { get; set; }
45 | public long?[] windows_devices_28_day { get; set; }
46 | public long?[] linux_devices_1_day { get; set; }
47 | public long?[] linux_devices_7_day { get; set; }
48 | public long?[] linux_devices_28_day { get; set; }
49 | public long?[] other_devices_1_day { get; set; }
50 | public long?[] other_devices_7_day { get; set; }
51 | public long?[] other_devices_28_day { get; set; }
52 | }
53 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/Event.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Models.Business
29 | {
30 | public class Event
31 | {
32 | public string event_type { get; set; }
33 | public string member_id { get; set; }
34 | public EventInfo info_dict { get; set; }
35 | public string ip_address { get; set; }
36 | public int user_id { get; set; }
37 | public string name { get; set; }
38 | public string country { get; set; }
39 | public string event_type_description { get; set; }
40 | public string event_category { get; set; }
41 | public DateTime time { get; set; }
42 | public string email { get; set; }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/EventInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class EventInfo
29 | {
30 | public string[] initial_devices { get; set; }
31 | public string[] initial_apps { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/Events.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 |
28 | namespace DropboxRestAPI.Models.Business
29 | {
30 | public class Events
31 | {
32 | public IEnumerable events { get; set; }
33 | public bool has_more { get; set; }
34 | public string cursor { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/GroupInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 | using DropboxRestAPI.Utils;
27 | using Newtonsoft.Json;
28 | using Newtonsoft.Json.Converters;
29 |
30 | namespace DropboxRestAPI.Models.Business
31 | {
32 | public class GroupInfo
33 | {
34 | ///
35 | /// The group's display name.
36 | ///
37 | public string group_name { get; set; }
38 |
39 | ///
40 | /// The group's id.
41 | ///
42 | public string group_id { get; set; }
43 |
44 | public int num_members { get; set; }
45 | public GroupMember[] members { get; set; }
46 |
47 | [JsonConverter(typeof(UnixEpochDateTimeConverter))]
48 | public DateTime created { get; set; }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/GroupMember.cs:
--------------------------------------------------------------------------------
1 | namespace DropboxRestAPI.Models.Business
2 | {
3 | public class GroupMember
4 | {
5 | public MemberProfile profile { get; set; }
6 | public string access_type { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/GroupsInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 |
27 | namespace DropboxRestAPI.Models.Business
28 | {
29 | public class GroupsInfo
30 | {
31 | public GroupInfo[] groups { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/MemberInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class MemberInfo
29 | {
30 | public MemberProfile profile { get; set; }
31 | public MemberPermissions permissions { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/MemberPermissions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class MemberPermissions
29 | {
30 | public bool is_admin { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/MemberProfile.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class MemberProfile
29 | {
30 | public string given_name { get; set; }
31 | public string surname { get; set; }
32 | public string status { get; set; }
33 | public string member_id { get; set; }
34 | public string email { get; set; }
35 | public bool email_verified { get; set; }
36 | public string external_id { get; set; }
37 | public string[] groups { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/Members.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 |
28 | namespace DropboxRestAPI.Models.Business
29 | {
30 | public class Members
31 | {
32 | public IEnumerable members { get; set; }
33 | public string cursor { get; set; }
34 | public bool has_more { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/MembershipInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class MembershipInfo
29 | {
30 | public string start_date { get; set; }
31 | public long?[] team_size { get; set; }
32 | public long?[] pending_invites { get; set; }
33 | public long?[] members_joined { get; set; }
34 | public long?[] licenses { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/PermissionInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class PermissionInfo
29 | {
30 | public string member_id { get; set; }
31 | public bool is_admin { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/StorageInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 |
28 | namespace DropboxRestAPI.Models.Business
29 | {
30 | public class StorageInfo
31 | {
32 | public string start_date { get; set; }
33 | public long?[] total_usage { get; set; }
34 | public long?[] shared_usage { get; set; }
35 | public long?[] unshared_usage { get; set; }
36 | public long?[] shared_folders { get; set; }
37 | public Dictionary[] member_storage_map { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Business/TeamInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Business
27 | {
28 | public class TeamInfo
29 | {
30 | ///
31 | /// The name of the team
32 | ///
33 | public string name { get; set; }
34 | ///
35 | /// Globally-unique team identifier
36 | ///
37 | public string team_id { get; set; }
38 | ///
39 | /// The total number of licenses the team has authorized
40 | ///
41 | public int num_licensed_users { get; set; }
42 | ///
43 | /// the number of accounts that have been invited or are already active members of the team
44 | ///
45 | public int num_provisioned_users { get; set; }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/AccountInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class AccountInfo
29 | {
30 |
31 | ///
32 | /// The user's referral link.
33 | ///
34 | public string referral_link { get; set; }
35 | ///
36 | /// The user's two-letter country code, if available.
37 | ///
38 | public string country { get; set; }
39 | ///
40 | /// The user's email address.
41 | ///
42 | public string email { get; set; }
43 | ///
44 | /// The user's display name.
45 | ///
46 | public string display_name { get; set; }
47 | ///
48 | /// Locale preference set by the user (e.g. en-us).
49 | ///
50 | public string locale { get; set; }
51 | ///
52 | /// If true, there is a paired account associated with this user.
53 | ///
54 | public bool is_paired { get; set; }
55 | ///
56 | /// The user's used quota details
57 | ///
58 | public QuotaInfo quota_info { get; set; }
59 | ///
60 | /// The user's unique Dropbox ID.
61 | ///
62 | public long uid { get; set; }
63 | ///
64 | /// If the user belongs to a team, contains team information. Otherwise, null.
65 | ///
66 | public AccountTeam team { get; set; }
67 | ///
68 | /// The user's name details
69 | ///
70 | public NameDetails name_details { get; set; }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/AccountTeam.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class AccountTeam
29 | {
30 | ///
31 | /// The id of the team the user belongs to.
32 | ///
33 | public string team_id { get; set; }
34 | ///
35 | /// The name of the team the user belongs to.
36 | ///
37 | public string name { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/ChunkedUpload.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 |
27 | namespace DropboxRestAPI.Models.Core
28 | {
29 | public class ChunkedUpload
30 | {
31 | public string upload_id { get; set; }
32 | public long offset { get; set; }
33 | public DateTime expires { get; set; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/CopyRef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 |
27 | namespace DropboxRestAPI.Models.Core
28 | {
29 | public class CopyRef
30 | {
31 | public string copy_ref { get; set; }
32 | public DateTime expires { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/DeltaCursor.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class DeltaCursor
28 | {
29 | ///
30 | /// A string that encodes the latest information that has been returned. On the next call to /delta, pass in this value.
31 | ///
32 | public string cursor { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Group.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class Group
28 | {
29 | ///
30 | /// The group's display name.
31 | ///
32 | public string display_name { get; set; }
33 |
34 | ///
35 | /// The group's id.
36 | ///
37 | public string id { get; set; }
38 |
39 | public int member_count { get; set; }
40 | public bool is_team_group { get; set; }
41 | public string access_type { get; set; }
42 | public bool same_team { get; set; }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Groups.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class Groups
28 | {
29 | public string access_type { get; set; }
30 | public Group group { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/LongpollDelta.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class LongPollDelta
28 | {
29 | public bool changes { get; set; }
30 | public int backoff { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/MediaLink.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 |
27 | namespace DropboxRestAPI.Models.Core
28 | {
29 | public class MediaLink
30 | {
31 | public string url { get; set; }
32 | public DateTime expires { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Membership.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class Membership
28 | {
29 | public User user { get; set; }
30 | public string access_type { get; set; }
31 | public bool active { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/NameDetails.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class NameDetails
29 | {
30 | ///
31 | /// The user's given name.
32 | ///
33 | public string given_name { get; set; }
34 |
35 | ///
36 | /// The user's surname.
37 | ///
38 | public string surname { get; set; }
39 |
40 | ///
41 | /// The locale-dependent familiar name for the user.
42 | ///
43 | public string familiar_name { get; set; }
44 | }
45 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Owner.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class Owner
28 | {
29 | ///
30 | /// Display name of the owner.
31 | ///
32 | public string display_name { get; set; }
33 | ///
34 | /// The Owner's unique Dropbox ID.
35 | ///
36 | public int uid { get; set; }
37 | ///
38 | /// If endpoint is called by a Dropbox for Business app , member_id of the owner.
39 | ///
40 | public string member_id { get; set; }
41 | }
42 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/PhotoInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class PhotoInfo
29 | {
30 | ///
31 | /// Creation time of the photo
32 | ///
33 | public string time_taken { get; set; }
34 | ///
35 | /// GPS coordinates of the photo
36 | ///
37 | public double[] lat_long { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Preview.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System.IO;
26 |
27 | namespace DropboxRestAPI.Models.Core
28 | {
29 | public class Preview
30 | {
31 | ///
32 | /// Data that represents a preview of the file.
33 | ///
34 | public Stream Content { get; set; }
35 | ///
36 | /// Either application/pdf or text/html
37 | ///
38 | public string ContentType { get; set; }
39 | }
40 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/QuotaInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class QuotaInfo
29 | {
30 | ///
31 | /// The user's used quota in shared folders (bytes). If the user belongs to a team, this includes all usage contributed to the team's quota outside of the user's own used quota (bytes).
32 | ///
33 | public long shared { get; set; }
34 | ///
35 | /// The user's total quota allocation (bytes). If the user belongs to a team, the team's total quota allocation (bytes).
36 | ///
37 | public long quota { get; set; }
38 | ///
39 | /// The user's used quota outside of shared folders (bytes).
40 | ///
41 | public long normal { get; set; }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/SaveUrl.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class SaveUrl
28 | {
29 | ///
30 | /// The job field gives a job ID that can be used with the /save_url_job endpoint to check the job's status.
31 | ///
32 | public string Job { get; set; }
33 | public SaveUrlStatus Status { get; set; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/SaveUrlJob.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class SaveUrlJob
28 | {
29 | public SaveUrlStatus Status { get; set; }
30 | public string Error { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/SaveUrlStatus.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public enum SaveUrlStatus
28 | {
29 | ///
30 | /// The job has not yet started.
31 | ///
32 | Pending,
33 | ///
34 | /// The job has started but hasn't yet completed.
35 | ///
36 | Downloading,
37 | ///
38 | /// The job is complete.
39 | ///
40 | Complete,
41 | ///
42 | /// The job failed.
43 | ///
44 | Failed
45 | }
46 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/SharedFolder.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class SharedFolder
28 | {
29 | public string shared_folder_id { get; set; }
30 | public bool is_team_only_shared_folder { get; set; }
31 | public string shared_folder_name { get; set; }
32 | public string path { get; set; }
33 | public string access_type { get; set; }
34 | public string shared_link_policy { get; set; }
35 | public Membership[] membership { get; set; }
36 | public Owner owner { get; set; }
37 | public Groups[] groups { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/SharedLink.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 |
27 | namespace DropboxRestAPI.Models.Core
28 | {
29 | public class SharedLink
30 | {
31 | ///
32 | /// The actual shared link URL
33 | ///
34 | public string url { get; set; }
35 | ///
36 | /// The link's expiration time
37 | ///
38 | public DateTime expires { get; set; }
39 | ///
40 | /// Indicates what (if any) restrictions are set on this particular link. Possible values include: "PUBLIC" (anyone can view),
41 | /// "TEAM_ONLY" (only the owner's team can view), "PASSWORD" (a password is required), "TEAM_AND_PASSWORD" (a combination of
42 | /// "TEAM_ONLY" and "PASSWORD" restrictions), or "SHARED_FOLDER_ONLY" (only members of the enclosing shared folder can view).
43 | /// Note that other values may be added at any time.
44 | ///
45 | public string visibility { get; set; }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/Token.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class Token
29 | {
30 | public string access_token { get; set; }
31 | public string token_type { get; set; }
32 | public string uid { get; set; }
33 | public string team_id { get; set; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/User.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Models.Core
26 | {
27 | public class User
28 | {
29 | ///
30 | /// Display name of the owner.
31 | ///
32 | public string display_name { get; set; }
33 | ///
34 | /// The user's unique Dropbox ID.
35 | ///
36 | public int uid { get; set; }
37 | ///
38 | /// If endpoint is called by a Dropbox for Business app , member_id of the user.
39 | ///
40 | public string member_id { get; set; }
41 | ///
42 | /// If the linked account is a member of a Dropbox for Business team, whether the user is on the same team as the linked account
43 | ///
44 | public bool same_team { get; set; }
45 | ///
46 | /// The user's email address.
47 | ///
48 | public string email { get; set; }
49 | ///
50 | /// If true, the user's email address has been verified to belong to that user.
51 | ///
52 | public bool email_verified { get; set; }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Core/VideoInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models.Core
27 | {
28 | public class VideoInfo
29 | {
30 | ///
31 | /// Creation time of the video
32 | ///
33 | public string time_taken { get; set; }
34 | ///
35 | /// GPS coordinates of the video
36 | ///
37 | public double[] lat_long { get; set; }
38 | ///
39 | /// Length of the video in milliseconds
40 | ///
41 | public long duration { get; set; }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Error.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Models
27 | {
28 | public class Error
29 | {
30 | public string error { get; set; }
31 | public string error_description { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Exceptions/NotEnoughQuotaException.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Models.Exceptions
29 | {
30 | public class NotEnoughQuotaException : Exception
31 | {
32 | public NotEnoughQuotaException()
33 | {
34 | }
35 |
36 | public NotEnoughQuotaException(string message)
37 | : base(message)
38 | {
39 | }
40 |
41 | public NotEnoughQuotaException(string message, Exception innerException)
42 | : base(message, innerException)
43 | {
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Exceptions/RetryLaterException.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Models.Exceptions
29 | {
30 | public class RetryLaterException : Exception
31 | {
32 | public RetryLaterException()
33 | {
34 | }
35 |
36 | public RetryLaterException(string message)
37 | : base(message)
38 | {
39 | }
40 |
41 | public RetryLaterException(string message, Exception innerException)
42 | : base(message, innerException)
43 | {
44 | }
45 |
46 | public decimal? RetryAfter { get; set; }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Models/Exceptions/ServiceErrorException.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Models.Exceptions
29 | {
30 | public class ServiceErrorException : Exception
31 | {
32 | public ServiceErrorException()
33 | {
34 | }
35 |
36 | public ServiceErrorException(int code)
37 | {
38 | Code = code;
39 | }
40 |
41 | public ServiceErrorException(int code, string message)
42 | : base(message)
43 | {
44 | Code = code;
45 | }
46 |
47 | public ServiceErrorException(int code, string message, Exception innerException)
48 | : base(message, innerException)
49 | {
50 | Code = code;
51 | }
52 |
53 | public int Code { get; set; }
54 | public string ErrorCode { get; set; }
55 | public string ErrorDescription { get; set; }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/src/DropboxRestAPI/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/BusinessRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.RequestsGenerators.Business
27 | {
28 | public class BusinessRequestGenerator : IBusinessRequestGenerator
29 | {
30 | public BusinessRequestGenerator()
31 | : this(new TeamInfoRequestGenerator(), new TeamMembersRequestGenerator(), new ReportsRequestGenerator(),
32 | new AuditLogRequestGenerator(), new GroupsRequestGenerator())
33 | {
34 | }
35 |
36 | public BusinessRequestGenerator(ITeamInfoRequestGenerator teamInfo, ITeamMembersRequestGenerator teamMembers,
37 | IReportsRequestGenerator reports, IAuditLogRequestGenerator auditLog, IGroupsRequestGenerator groups)
38 | {
39 | TeamInfo = teamInfo;
40 | TeamMembers = teamMembers;
41 | Reports = reports;
42 | AuditLog = auditLog;
43 | Groups = groups;
44 | }
45 |
46 | #region Implementation of IBusinessRequestGenerator
47 |
48 | public ITeamInfoRequestGenerator TeamInfo { get; private set; }
49 | public ITeamMembersRequestGenerator TeamMembers { get; private set; }
50 | public IReportsRequestGenerator Reports { get; private set; }
51 | public IAuditLogRequestGenerator AuditLog { get; private set; }
52 | public IGroupsRequestGenerator Groups { get; private set; }
53 |
54 | #endregion
55 | }
56 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/GroupsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 | using System.Net.Http;
28 | using System.Net.Http.Headers;
29 | using DropboxRestAPI.Utils;
30 |
31 | namespace DropboxRestAPI.RequestsGenerators.Business
32 | {
33 | public class GroupsRequestGenerator : IGroupsRequestGenerator
34 | {
35 | public IRequest GetInfoAsync(IEnumerable group_ids)
36 | {
37 | var request = new Request
38 | {
39 | Method = HttpMethod.Post,
40 | BaseAddress = Consts.ApiBaseUrl,
41 | Resource = Consts.Version + "/team/groups/get_info"
42 | };
43 | request.Content = new JsonContent(new { group_ids });
44 | request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
45 |
46 | return request;
47 | }
48 |
49 | public IRequest ListAsync()
50 | {
51 | var request = new Request
52 | {
53 | Method = HttpMethod.Post,
54 | BaseAddress = Consts.ApiBaseUrl,
55 | Resource = Consts.Version + "/team/groups/list"
56 | };
57 | request.Content = new JsonContent(new { });
58 | request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
59 |
60 | return request;
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/IAuditLogRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using DropboxRestAPI.Utils;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators.Business
30 | {
31 | public interface IAuditLogRequestGenerator
32 | {
33 | IRequest GetEvents(int limit = 1000, string cursor = null, string member_id = null, string user_id = null, string user_email = null, string category = null, DateTime? start_ts = null, DateTime? end_ts = null);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/IBusinessRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.RequestsGenerators.Business
27 | {
28 | public interface IBusinessRequestGenerator
29 | {
30 | ITeamInfoRequestGenerator TeamInfo { get; }
31 | ITeamMembersRequestGenerator TeamMembers { get; }
32 | IReportsRequestGenerator Reports { get; }
33 | IAuditLogRequestGenerator AuditLog { get; }
34 | IGroupsRequestGenerator Groups { get; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/IGroupsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 | using DropboxRestAPI.Utils;
28 | using Newtonsoft.Json.Linq;
29 |
30 | namespace DropboxRestAPI.RequestsGenerators.Business
31 | {
32 | public interface IGroupsRequestGenerator
33 | {
34 | IRequest GetInfoAsync(IEnumerable group_ids);
35 | IRequest ListAsync();
36 | }
37 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/IReportsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using DropboxRestAPI.Utils;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators.Business
30 | {
31 | public interface IReportsRequestGenerator
32 | {
33 | IRequest GetStorage(DateTime? start_date, DateTime? end_date);
34 | IRequest GetActivity(DateTime? start_date, DateTime? end_date);
35 | IRequest GetMembership(DateTime? start_date, DateTime? end_date);
36 | IRequest GetDevices(DateTime? start_date, DateTime? end_date);
37 | }
38 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/ITeamInfoRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Utils;
27 |
28 | namespace DropboxRestAPI.RequestsGenerators.Business
29 | {
30 | public interface ITeamInfoRequestGenerator
31 | {
32 | IRequest GetInfo();
33 | IRequest GetMembers(int limit = 1000, string cursor = null);
34 | IRequest GetMemberInfo(string member_id = null, string email = null, string external_id = null);
35 | IRequest GetMembersInfoBatch(string[] member_ids = null, string[] emails = null, string[] external_ids = null);
36 | }
37 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Business/ITeamMembersRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Utils;
27 |
28 | namespace DropboxRestAPI.RequestsGenerators.Business
29 | {
30 | public interface ITeamMembersRequestGenerator
31 | {
32 | IRequest Add(string member_email, string member_given_name, string member_surname, string member_external_id = null, bool? send_welcome_email = null);
33 | IRequest SetProfile(string member_id = null, string external_id = null, string new_email = null, string new_external_id = null);
34 | IRequest SetPermissions(string member_id = null, string external_id = null, bool? new_is_admin = null);
35 | IRequest Remove(string member_id = null, string external_id = null, string transfer_dest_member_id = null, string transfer_admin_member_id = null, bool delete_data = true);
36 | }
37 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Consts.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.RequestsGenerators
26 | {
27 | public static class Consts
28 | {
29 | public const string ApiBaseUrl = "https://api.dropbox.com";
30 | public const string ApiContentBaseUrl = "https://api-content.dropbox.com";
31 | public const string ApiNotifyBaseUrl = "https://api-notify.dropbox.com";
32 |
33 | public const string Version = "1";
34 | public const string AsTeamMemberHeader = "X-Dropbox-Perform-As-Team-Member";
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/AccountsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 | using DropboxRestAPI.Utils;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators.Core
30 | {
31 | public class AccountsRequestGenerator : IAccountsRequestGenerator
32 | {
33 | public IRequest AccountInfo(string locale = null, string asTeamMember = null)
34 | {
35 | var request = new Request
36 | {
37 | Method = HttpMethod.Get,
38 | BaseAddress = Consts.ApiBaseUrl,
39 | Resource = Consts.Version + "/account/info"
40 | };
41 | request.AddHeader(Consts.AsTeamMemberHeader, asTeamMember);
42 | request.AddParameter("locale", locale);
43 |
44 | return request;
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/CoreRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.RequestsGenerators.Core
27 | {
28 | public class CoreRequestGenerator : ICoreRequestGenerator
29 | {
30 | public CoreRequestGenerator()
31 | : this(new OAuth2RequestGenerator(), new AccountsRequestGenerator(), new MetadataRequestGenerator(), new FileOperationsRequestGenerator())
32 | {
33 |
34 | }
35 | public CoreRequestGenerator(IOAuth2RequestGenerator oauth2, IAccountsRequestGenerator accounts, IMetadataRequestGenerator metadata, IFileOperationsRequestGenerator fileOperations)
36 | {
37 | OAuth2 = oauth2;
38 | Accounts = accounts;
39 | Metadata = metadata;
40 | FileOperations = fileOperations;
41 | }
42 |
43 | #region Implementation of ICoreRequestGenerator
44 |
45 | public IOAuth2RequestGenerator OAuth2 { get; private set; }
46 | public IAccountsRequestGenerator Accounts { get; private set; }
47 | public IMetadataRequestGenerator Metadata { get; private set; }
48 | public IFileOperationsRequestGenerator FileOperations { get; private set; }
49 |
50 | #endregion
51 | }
52 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/IAccountsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Utils;
27 |
28 | namespace DropboxRestAPI.RequestsGenerators.Core
29 | {
30 | public interface IAccountsRequestGenerator
31 | {
32 | IRequest AccountInfo(string locale = null, string asTeamMember = null);
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/ICoreRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.RequestsGenerators.Core
27 | {
28 | public interface ICoreRequestGenerator
29 | {
30 | IOAuth2RequestGenerator OAuth2 { get; }
31 | IAccountsRequestGenerator Accounts { get; }
32 | IMetadataRequestGenerator Metadata { get; }
33 | IFileOperationsRequestGenerator FileOperations { get; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/IFileOperationsRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Utils;
27 |
28 | namespace DropboxRestAPI.RequestsGenerators.Core
29 | {
30 | public interface IFileOperationsRequestGenerator
31 | {
32 | IRequest Copy(string root, string from_path, string to_path, string from_copy_ref = null, string locale = null, string asTeamMember = null);
33 | IRequest CreateFolder(string root, string path, string locale = null, string asTeamMember = null);
34 | IRequest Delete(string root, string path, string locale = null, string asTeamMember = null);
35 | IRequest Move(string root, string from_path, string to_path, string locale = null, string asTeamMember = null);
36 | }
37 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/IOAuth2RequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.Utils;
27 |
28 | namespace DropboxRestAPI.RequestsGenerators.Core
29 | {
30 | public interface IOAuth2RequestGenerator
31 | {
32 | IRequest Authorize(string response_type, string client_id, string redirect_uri, string state = null, bool force_reapprove = false, bool disable_signup = false, string require_role = null);
33 | IRequest AccessToken(string clientId, string clientSecret, string callbackUrl, string authorizationCode);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/Core/OAuthRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 | using DropboxRestAPI.Utils;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators.Core
30 | {
31 | public class OAuth2RequestGenerator : IOAuth2RequestGenerator
32 | {
33 | public IRequest Authorize(string response_type, string client_id, string redirect_uri, string state = null, bool force_reapprove = false, bool disable_signup = false, string require_role = null)
34 | {
35 | var request = new Request
36 | {
37 | Method = HttpMethod.Get,
38 | BaseAddress = Consts.ApiBaseUrl,
39 | Resource = Consts.Version + "/oauth2/authorize"
40 | };
41 |
42 | request.AddParameter("response_type", response_type);
43 | request.AddParameter("client_id", client_id);
44 | request.AddParameter("redirect_uri", redirect_uri);
45 | request.AddParameter("require_role", require_role);
46 | request.AddParameter("state", state);
47 | if (force_reapprove)
48 | request.AddParameter("force_reapprove", "true");
49 | if (disable_signup)
50 | request.AddParameter("disable_signup", "true");
51 |
52 | return request;
53 | }
54 |
55 | public IRequest AccessToken(string clientId, string clientSecret, string callbackUrl, string authorizationCode)
56 | {
57 | var request = new Request
58 | {
59 | Method = HttpMethod.Post,
60 | BaseAddress = Consts.ApiBaseUrl,
61 | Resource = Consts.Version + "/oauth2/token"
62 | };
63 |
64 | request.AddParameter("code", authorizationCode);
65 | request.AddParameter("grant_type", "authorization_code");
66 | request.AddParameter("client_id", clientId);
67 | request.AddParameter("client_secret", clientSecret);
68 | request.AddParameter("redirect_uri", callbackUrl);
69 |
70 | return request;
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/IRequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.RequestsGenerators.Business;
27 | using DropboxRestAPI.RequestsGenerators.Core;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators
30 | {
31 | public interface IRequestGenerator
32 | {
33 | ICoreRequestGenerator Core { get; }
34 | IBusinessRequestGenerator Business { get; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/RequestsGenerators/RequestGenerator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.RequestsGenerators.Business;
27 | using DropboxRestAPI.RequestsGenerators.Core;
28 |
29 | namespace DropboxRestAPI.RequestsGenerators
30 | {
31 | public class RequestGenerator : IRequestGenerator
32 | {
33 | public RequestGenerator()
34 | : this(new CoreRequestGenerator(), new BusinessRequestGenerator())
35 | {
36 | }
37 |
38 | public RequestGenerator(ICoreRequestGenerator core, IBusinessRequestGenerator business)
39 | {
40 | Core = core;
41 | Business = business;
42 | }
43 |
44 |
45 | public ICoreRequestGenerator Core { get; set; }
46 | public IBusinessRequestGenerator Business { get; set; }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Business/AuditLog.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using System.Threading.Tasks;
28 | using DropboxRestAPI.Models.Business;
29 | using DropboxRestAPI.RequestsGenerators.Business;
30 |
31 | namespace DropboxRestAPI.Services.Business
32 | {
33 | public class AuditLog : IAuditLog
34 | {
35 | private readonly IRequestExecuter _requestExecuter;
36 | private readonly IAuditLogRequestGenerator _requestGenerator;
37 |
38 | public AuditLog(IRequestExecuter requestExecuter, IAuditLogRequestGenerator requestGenerator)
39 | {
40 | _requestGenerator = requestGenerator;
41 | _requestExecuter = requestExecuter;
42 | }
43 |
44 | public async Task GetEventsAsync(int limit = 1000, string cursor = null, string member_id = null, string user_id = null, string user_email = null, string category = null,
45 | DateTime? start_ts = null, DateTime? end_ts = null)
46 | {
47 | return await _requestExecuter.Execute(() => _requestGenerator.GetEvents(limit, cursor, member_id, user_id, user_email, category, start_ts, end_ts)).ConfigureAwait(false);
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Business/Business.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.RequestsGenerators;
27 |
28 | namespace DropboxRestAPI.Services.Business
29 | {
30 | public class Business : IBusiness
31 | {
32 | public Business(IRequestExecuter requestExecuter, IRequestGenerator requestGenerator)
33 | {
34 | Info = new Info(requestExecuter, requestGenerator.Business.TeamInfo);
35 | Members = new Members(requestExecuter, requestGenerator.Business.TeamMembers);
36 | Reports = new Reports(requestExecuter, requestGenerator.Business.Reports);
37 | AuditLog = new AuditLog(requestExecuter, requestGenerator.Business.AuditLog);
38 | Groups = new Groups(requestExecuter, requestGenerator.Business.Groups);
39 | }
40 |
41 | public IInfo Info { get; set; }
42 | public IMembers Members { get; set; }
43 | public IReports Reports { get; set; }
44 | public IAuditLog AuditLog { get; set; }
45 | public IGroups Groups { get; set; }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Business/Groups.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 | using System.Threading;
28 | using System.Threading.Tasks;
29 | using DropboxRestAPI.Models.Business;
30 | using DropboxRestAPI.RequestsGenerators.Business;
31 |
32 | namespace DropboxRestAPI.Services.Business
33 | {
34 | public class Groups : IGroups
35 | {
36 | private readonly IRequestExecuter _requestExecuter;
37 | private readonly IGroupsRequestGenerator _requestGenerator;
38 |
39 | public Groups(IRequestExecuter requestExecuter, IGroupsRequestGenerator requestGenerator)
40 | {
41 | _requestGenerator = requestGenerator;
42 | _requestExecuter = requestExecuter;
43 | }
44 |
45 |
46 | public async Task GetInfoAsync(IEnumerable group_ids, CancellationToken cancellationToken = new CancellationToken())
47 | {
48 | return await _requestExecuter.Execute(() => _requestGenerator.GetInfoAsync(group_ids), cancellationToken: cancellationToken).ConfigureAwait(false);
49 | }
50 |
51 | public async Task ListAsync(CancellationToken cancellationToken = new CancellationToken())
52 | {
53 | return await _requestExecuter.Execute(() => _requestGenerator.ListAsync(), cancellationToken: cancellationToken).ConfigureAwait(false);
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Business/IBusiness.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Services.Business
27 | {
28 | public interface IBusiness
29 | {
30 | IInfo Info { get; set; }
31 | IMembers Members { get; set; }
32 | IReports Reports { get; set; }
33 | IAuditLog AuditLog { get; set; }
34 | IGroups Groups { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Business/IGroups.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Collections.Generic;
27 | using System.Threading;
28 | using System.Threading.Tasks;
29 | using DropboxRestAPI.Models.Business;
30 |
31 | namespace DropboxRestAPI.Services.Business
32 | {
33 | public interface IGroups
34 | {
35 | ///
36 | /// Retrieves information about a team.
37 | ///
38 | /// Information about a team.
39 | Task GetInfoAsync(IEnumerable group_ids, CancellationToken cancellationToken = default(CancellationToken));
40 |
41 | ///
42 | /// Lists members of a team.
43 | ///
44 | /// The cancellation token to cancel operation.
45 | /// A list of team members.
46 | Task ListAsync(CancellationToken cancellationToken = default(CancellationToken));
47 | }
48 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/Accounts.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Threading;
27 | using System.Threading.Tasks;
28 | using DropboxRestAPI.Models.Core;
29 | using DropboxRestAPI.RequestsGenerators.Core;
30 |
31 | namespace DropboxRestAPI.Services.Core
32 | {
33 | public class Accounts : IAccounts
34 | {
35 | private readonly IRequestExecuter _requestExecuter;
36 | private readonly IAccountsRequestGenerator _requestGenerator;
37 |
38 | public Accounts(IRequestExecuter requestExecuter, IAccountsRequestGenerator requestGenerator)
39 | {
40 | _requestExecuter = requestExecuter;
41 | _requestGenerator = requestGenerator;
42 | }
43 |
44 | public async Task AccountInfoAsync(string locale = null, string asTeamMember = null, CancellationToken cancellationToken = default(CancellationToken))
45 | {
46 | return await _requestExecuter.Execute(() => _requestGenerator.AccountInfo(locale, asTeamMember), cancellationToken: cancellationToken).ConfigureAwait(false);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/Core.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using DropboxRestAPI.RequestsGenerators.Core;
27 |
28 | namespace DropboxRestAPI.Services.Core
29 | {
30 | public class Core : ICore
31 | {
32 | public IOAuth2 OAuth2 { get; private set; }
33 | public IAccounts Accounts { get; private set; }
34 | public IMetadata Metadata { get; private set; }
35 | public IFileOperations FileOperations { get; private set; }
36 |
37 | public Core(IRequestExecuter requestExecuter, ICoreRequestGenerator requestGenerator, Options options)
38 | {
39 | OAuth2 = new OAuth2(requestExecuter, requestGenerator.OAuth2, options);
40 | Accounts = new Accounts(requestExecuter, requestGenerator.Accounts);
41 | Metadata = new Metadata(requestExecuter, requestGenerator.Metadata, options);
42 | FileOperations = new FileOperations(requestExecuter, requestGenerator.FileOperations, options);
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/IAccounts.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Threading;
27 | using System.Threading.Tasks;
28 | using DropboxRestAPI.Models.Core;
29 |
30 | namespace DropboxRestAPI.Services.Core
31 | {
32 | public interface IAccounts
33 | {
34 | ///
35 | /// Retrieves information about the user's account.
36 | /// https://www.dropbox.com/developers/core/docs#account-info
37 | ///
38 | /// Use to specify language settings for user error messages and other language specific text.
39 | /// Specify the member_id of the user that the app wants to act on.
40 | /// The cancellation token to cancel operation.
41 | ///
42 | /// User account information.
43 | ///
44 | Task AccountInfoAsync(string locale = null, string asTeamMember = null, CancellationToken cancellationToken = default(CancellationToken));
45 | }
46 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/ICore.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | namespace DropboxRestAPI.Services.Core
27 | {
28 | public interface ICore
29 | {
30 | IOAuth2 OAuth2 { get; }
31 | IAccounts Accounts { get; }
32 | IMetadata Metadata { get; }
33 | IFileOperations FileOperations { get; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/IMetadata.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/src/DropboxRestAPI/Services/Core/IMetadata.cs
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/IOAuth2.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/src/DropboxRestAPI/Services/Core/IOAuth2.cs
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Services/Core/OAuth2.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using System.Threading;
28 | using System.Threading.Tasks;
29 | using DropboxRestAPI.Models.Core;
30 | using DropboxRestAPI.RequestsGenerators.Core;
31 |
32 | namespace DropboxRestAPI.Services.Core
33 | {
34 | public class OAuth2 : IOAuth2
35 | {
36 | private readonly IRequestExecuter _requestExecuter;
37 | private readonly IOAuth2RequestGenerator _requestGenerator;
38 | private readonly Options _options;
39 |
40 | public OAuth2(IRequestExecuter requestExecuter, IOAuth2RequestGenerator requestGenerator, Options options)
41 | {
42 | _requestExecuter = requestExecuter;
43 | _requestGenerator = requestGenerator;
44 | _options = options;
45 | }
46 |
47 | #region Implementation of IOAuth2
48 |
49 | public Uri Authorize(string response_type, string state = null, bool force_reapprove = false, bool disable_signup = false, string require_role = null)
50 | {
51 | var request = _requestGenerator.Authorize(response_type, _options.ClientId, _options.RedirectUri, state, force_reapprove, disable_signup, require_role);
52 |
53 | return request.BuildUri();
54 | }
55 |
56 | public async Task TokenAsync(string code, CancellationToken cancellationToken = default(CancellationToken))
57 | {
58 | var token = await _requestExecuter.Execute(() => _requestGenerator.AccessToken(_options.ClientId, _options.ClientSecret, _options.RedirectUri, code), cancellationToken: cancellationToken).ConfigureAwait(false);
59 |
60 | _options.AccessToken = token.access_token;
61 | return token;
62 | }
63 |
64 | #endregion
65 | }
66 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/DateTimeUtils.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 | using System.Globalization;
28 |
29 | namespace DropboxRestAPI.Utils
30 | {
31 | public static class DateTimeUtils
32 | {
33 | public static DateTime GetDateTimeFromString(string dateTimeStr)
34 | {
35 | //cast to datetime and return
36 | return dateTimeStr == null ? DateTime.MinValue : DateTime.Parse(dateTimeStr); //RFC1123 format date codes are returned by API
37 | }
38 |
39 | public static DateTime GetUTCDateTimeFromString(string dateTimeStr)
40 | {
41 | string str = dateTimeStr;
42 | if (str == null)
43 | return DateTime.MinValue;
44 | if (str.EndsWith(" +0000")) str = str.Substring(0, str.Length - 6);
45 | if (!str.EndsWith(" UTC")) str += " UTC";
46 | return DateTime.ParseExact(str, "ddd, d MMM yyyy HH:mm:ss UTC", CultureInfo.InvariantCulture);
47 | }
48 |
49 | public static string GetStringFromDateTime(DateTime dateTime)
50 | {
51 | return dateTime.ToString("ddd, d MMM yyyy HH:mm:ss UTC");
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/HttpClientExtensions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 | using System.Threading;
28 | using System.Threading.Tasks;
29 |
30 | namespace DropboxRestAPI.Utils
31 | {
32 | public static class HttpClientExtensions
33 | {
34 | public static async Task Execute(this HttpClient client, IRequest request, CancellationToken cancellationToken = default(CancellationToken))
35 | {
36 | var requestMessage = new HttpRequestMessage(request.Method, request.BuildUri());
37 | if (request.Content != null)
38 | requestMessage.Content = request.Content;
39 |
40 | if (request.Headers != null)
41 | {
42 | foreach (var header in request.Headers)
43 | {
44 | requestMessage.Headers.Add(header.Key, header.Value);
45 | }
46 | }
47 |
48 | return await client.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/HttpException.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System;
27 |
28 | namespace DropboxRestAPI.Utils
29 | {
30 | public class HttpException : Exception
31 | {
32 | public HttpException()
33 | {
34 | }
35 |
36 | public HttpException(string message)
37 | : base(message)
38 | {
39 | }
40 |
41 | public HttpException(string message, Exception innerException)
42 | : base(message, innerException)
43 | {
44 | }
45 |
46 | public HttpException(int httpCode, string message)
47 | : base(message)
48 | {
49 | HttpCode = httpCode;
50 | }
51 |
52 | public HttpException(int httpCode, string message, Exception innerException)
53 | : base(message, innerException)
54 | {
55 | HttpCode = httpCode;
56 | }
57 |
58 | public int HttpCode { get; private set; }
59 |
60 | public int? Attempts { get; set; }
61 |
62 | public override string ToString()
63 | {
64 | var s = string.Format("HttpStatusCode: {0}", HttpCode);
65 | s += Environment.NewLine + string.Format("Message: {0}", Message);
66 | s += Environment.NewLine + base.ToString();
67 | return s;
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/HttpUtility.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 | using System.Linq;
27 | using System.Net;
28 |
29 | namespace DropboxRestAPI.Utils
30 | {
31 | public static class HttpValueCollectionExtensions
32 | {
33 | public static HttpValueCollection ParseQueryString(this string query)
34 | {
35 | if (query == null)
36 | {
37 | throw new ArgumentNullException("query");
38 | }
39 |
40 | if ((query.Length > 0) && (query[0] == '?'))
41 | {
42 | query = query.Substring(1);
43 | }
44 |
45 | return new HttpValueCollection(query, true);
46 | }
47 |
48 | public static string ToQueryString(this HttpValueCollection nvc, bool includePrefix = true)
49 | {
50 | string[] array = (from kvp in nvc
51 | select string.Format("{0}={1}", Uri.EscapeUriString(kvp.Key), Uri.EscapeDataString(kvp.Value)))
52 | .ToArray();
53 | return (includePrefix ? "?" : "") + string.Join("&", array);
54 | }
55 |
56 | public static string EncodePathParts(this string path)
57 | {
58 | return string.Join("/", path.Split('/', '\\')
59 | .Select(s => WebUtility.UrlEncode(s).Replace("+", "%20")));
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/HttpValue.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | namespace DropboxRestAPI.Utils
26 | {
27 | public sealed class HttpValue
28 | {
29 | public HttpValue()
30 | {
31 | }
32 |
33 | public HttpValue(string key, string value)
34 | {
35 | Key = key;
36 | Value = value;
37 | }
38 |
39 | public string Key { get; set; }
40 | public string Value { get; set; }
41 | }
42 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/JsonContent.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 |
26 | using System.Net.Http;
27 | using System.Text;
28 | using Newtonsoft.Json;
29 |
30 | namespace DropboxRestAPI.Utils
31 | {
32 | public class JsonContent : StringContent
33 | {
34 | public JsonContent(object content)
35 | : base(JsonConvert.SerializeObject(content), Encoding.UTF8, "application/json")
36 | {
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/TupleStringMetadataConverter.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Itay Sagui
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | using System;
26 | using System.Collections.Generic;
27 | using System.Linq;
28 | using System.Reflection;
29 | using DropboxRestAPI.Models.Core;
30 | using Newtonsoft.Json;
31 | using Newtonsoft.Json.Linq;
32 |
33 | namespace DropboxRestAPI.Utils
34 | {
35 | public class TupleStringMetadataConverter : JsonConverter
36 | {
37 | #region Overrides of JsonConverter
38 |
39 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
40 | {
41 | List> jlist = ((List>)value).Select(t => new Tuple(t.Item1, new JRaw(t.Item2))).ToList();
42 | serializer.Serialize(writer, jlist);
43 |
44 | }
45 |
46 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
47 | {
48 | JArray jarray = JArray.Load(reader);
49 |
50 | var result = new List>(jarray.Count);
51 | foreach (JToken j in jarray)
52 | {
53 | string item1 = ((JArray)j)[0].ToString();
54 | var item2 = ((JArray)j)[1].ToObject();
55 | result.Add(new Tuple(item1, item2));
56 | }
57 | return result;
58 |
59 | }
60 |
61 | public override bool CanConvert(Type objectType)
62 | {
63 | return typeof(IEnumerable>).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
64 | }
65 |
66 | #endregion
67 | }
68 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/Utils/UnixEpochDateTimeConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace DropboxRestAPI.Utils
5 | {
6 | public class UnixEpochDateTimeConverter : JsonConverter
7 | {
8 | public static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
9 |
10 | public override bool CanConvert(Type objectType)
11 | {
12 | return objectType == typeof(DateTime);
13 | }
14 |
15 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
16 | {
17 | long t = 0;
18 | if (reader.TokenType == JsonToken.String)
19 | t = long.Parse((string)reader.Value);
20 | else if(reader.TokenType == JsonToken.Integer)
21 | t = (long)reader.Value;
22 |
23 | return Epoch.AddMilliseconds(t);
24 | }
25 |
26 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
27 | {
28 | throw new NotImplementedException();
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DropboxRestAPI/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Sample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropboxRestAPI", "DropboxRestAPI\DropboxRestAPI.csproj", "{FA69B792-FCFF-4CB1-8435-798112337306}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{A1563ED0-2609-4CB0-8BEB-E0B4485C2B9A}"
9 | ProjectSection(SolutionItems) = preProject
10 | .nuget\NuGet.Config = .nuget\NuGet.Config
11 | .nuget\NuGet.exe = .nuget\NuGet.exe
12 | .nuget\NuGet.targets = .nuget\NuGet.targets
13 | EndProjectSection
14 | EndProject
15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{76D6681F-4BD6-48E0-BE15-775BE0F41F17}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Any CPU = Debug|Any CPU
20 | Release|Any CPU = Release|Any CPU
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {FA69B792-FCFF-4CB1-8435-798112337306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {FA69B792-FCFF-4CB1-8435-798112337306}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {FA69B792-FCFF-4CB1-8435-798112337306}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {FA69B792-FCFF-4CB1-8435-798112337306}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {76D6681F-4BD6-48E0-BE15-775BE0F41F17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28 | {76D6681F-4BD6-48E0-BE15-775BE0F41F17}.Debug|Any CPU.Build.0 = Debug|Any CPU
29 | {76D6681F-4BD6-48E0-BE15-775BE0F41F17}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {76D6681F-4BD6-48E0-BE15-775BE0F41F17}.Release|Any CPU.Build.0 = Release|Any CPU
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | EndGlobal
36 |
--------------------------------------------------------------------------------
/src/Sample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Sample/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using DropboxRestAPI;
6 |
7 | namespace Sample
8 | {
9 | class Program
10 | {
11 | private static void Main()
12 | {
13 | Run().Wait();
14 | }
15 |
16 | private static async Task Run()
17 | {
18 | var options = new Options
19 | {
20 | ClientId = "...",
21 | ClientSecret = "...",
22 | RedirectUri = "..."
23 | };
24 |
25 | // Initialize a new Client (without an AccessToken)
26 | var client = new Client(options);
27 |
28 | // Get the OAuth Request Url
29 | var authRequestUrl = await client.Core.OAuth2.AuthorizeAsync("code");
30 |
31 | // TODO: Navigate to authRequestUrl using the browser, and retrieve the Authorization Code from the response
32 | var authCode = "...";
33 |
34 | // Exchange the Authorization Code with Access/Refresh tokens
35 | var token = await client.Core.OAuth2.TokenAsync(authCode);
36 |
37 | // Get account info
38 | var accountInfo = await client.Core.Accounts.AccountInfoAsync();
39 | Console.WriteLine("Uid: " + accountInfo.uid);
40 | Console.WriteLine("Display_name: " + accountInfo.display_name);
41 | Console.WriteLine("Email: " + accountInfo.email);
42 |
43 | // Get root folder without content
44 | var rootFolder = await client.Core.Metadata.MetadataAsync("/", list: false);
45 | Console.WriteLine("Root Folder: {0} (Id: {1})", rootFolder.Name, rootFolder.path);
46 |
47 | // Get root folder with content
48 | rootFolder = await client.Core.Metadata.MetadataAsync("/", list: true);
49 | foreach (var folder in rootFolder.contents)
50 | {
51 | Console.WriteLine(" -> {0}: {1} (Id: {2})",
52 | folder.is_dir ? "Folder" : "File", folder.Name, folder.path);
53 | }
54 |
55 | // Initialize a new Client (with an AccessToken)
56 | var client2 = new Client(options);
57 |
58 | // Create a new folder
59 | var newFolder = await client2.Core.FileOperations.CreateFolderAsync("/New Folder");
60 |
61 | // Find a file in the root folder
62 | var file = rootFolder.contents.FirstOrDefault(x => x.is_dir == false);
63 |
64 | // Download a file
65 | var tempFile = Path.GetTempFileName();
66 | using (var fileStream = System.IO.File.OpenWrite(tempFile))
67 | {
68 | await client2.Core.Metadata.FilesAsync(file.path, fileStream);
69 | }
70 |
71 | //Upload the downloaded file to the new folder
72 |
73 | using (var fileStream = System.IO.File.OpenRead(tempFile))
74 | {
75 | var uploadedFile =await client2.Core.Metadata.FilesPutAsync(fileStream, newFolder.path + "/" + file.Name);
76 | }
77 |
78 | // Search file based on name
79 | var searchResults = await client2.Core.Metadata.SearchAsync("/", file.Name);
80 | foreach (var searchResult in searchResults)
81 | {
82 | Console.WriteLine("Found: " + searchResult.path);
83 | }
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/Sample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/saguiitay/DropboxRestAPI/9ee68c85f88508ca45312c62d8d23d893603dc52/src/Sample/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/src/Sample/Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {76D6681F-4BD6-48E0-BE15-775BE0F41F17}
8 | Exe
9 | Properties
10 | Sample
11 | Sample
12 | v4.5
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {fa69b792-fcff-4cb1-8435-798112337306}
55 | DropboxRestAPI
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/src/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------