├── DreamFactory.Tests ├── TestData │ └── rest │ │ ├── db │ │ ├── _schema │ │ │ ├── put.json │ │ │ ├── post.json │ │ │ ├── staff │ │ │ │ ├── delete.json │ │ │ │ ├── field │ │ │ │ │ └── get.json │ │ │ │ └── get.json │ │ │ ├── post.request.json │ │ │ └── put.request.json │ │ ├── _func │ │ │ ├── get.json │ │ │ └── foo │ │ │ │ ├── post.request.json │ │ │ │ └── post.json │ │ ├── _proc │ │ │ ├── get.json │ │ │ └── foo │ │ │ │ ├── get.json │ │ │ │ ├── post.request.json │ │ │ │ └── post.json │ │ ├── _table │ │ │ ├── staff │ │ │ │ ├── delete.json │ │ │ │ ├── delete.request.json │ │ │ │ ├── patch.json │ │ │ │ ├── patch.request.json │ │ │ │ ├── post.json │ │ │ │ └── post.request.json │ │ │ └── get.json │ │ └── get.json │ │ ├── system │ │ ├── app │ │ │ ├── 1 │ │ │ │ └── get.json │ │ │ ├── delete.json │ │ │ ├── patch.json │ │ │ ├── post.json │ │ │ ├── post.request.json │ │ │ └── patch.request.json │ │ ├── admin │ │ │ ├── password │ │ │ │ ├── post.json │ │ │ │ └── post.request.json │ │ │ └── session │ │ │ │ ├── delete.json │ │ │ │ ├── post.request.json │ │ │ │ ├── get.json │ │ │ │ └── post.json │ │ ├── lookup │ │ │ ├── delete.json │ │ │ ├── patch.json │ │ │ ├── post.json │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ └── get.json │ │ ├── config │ │ │ ├── post.request.json │ │ │ ├── get.json │ │ │ └── post.json │ │ ├── app_group │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ ├── delete.json │ │ │ ├── get.json │ │ │ ├── patch.json │ │ │ └── post.json │ │ ├── role │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ ├── post.json │ │ │ ├── delete.json │ │ │ ├── patch.json │ │ │ └── get.json │ │ ├── user │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ ├── delete.json │ │ │ ├── patch.json │ │ │ ├── post.json │ │ │ └── get.json │ │ ├── email_template │ │ │ ├── post.request.json │ │ │ └── patch.request.json │ │ ├── service │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ ├── patch.json │ │ │ ├── post.json │ │ │ ├── delete.json │ │ │ └── get.json │ │ ├── cors │ │ │ ├── post.request.json │ │ │ ├── patch.request.json │ │ │ ├── delete.json │ │ │ ├── get.json │ │ │ ├── patch.json │ │ │ └── post.json │ │ ├── event │ │ │ ├── system.get.pre_process │ │ │ │ ├── post.json │ │ │ │ ├── get.json │ │ │ │ └── delete.json │ │ │ └── get.json │ │ ├── constant │ │ │ └── content_types │ │ │ │ └── get.json │ │ └── script_type │ │ │ └── get.json │ │ ├── user │ │ ├── custom │ │ │ ├── Language │ │ │ │ ├── get.json │ │ │ │ ├── patch.json │ │ │ │ ├── patch.request.json │ │ │ │ └── delete.json │ │ │ ├── patch.json │ │ │ ├── post.json │ │ │ ├── patch.request.json │ │ │ ├── post.request.json │ │ │ └── get.json │ │ ├── profile │ │ │ ├── post.json │ │ │ ├── post.request.json │ │ │ └── get.json │ │ ├── password-complete │ │ │ ├── post.json │ │ │ └── post.request.json │ │ ├── session │ │ │ ├── delete.json │ │ │ ├── post.request.json │ │ │ ├── get.json │ │ │ └── post.json │ │ ├── password-reset │ │ │ ├── post.request.json │ │ │ └── post.json │ │ ├── password │ │ │ ├── post.request.json │ │ │ └── post.json │ │ ├── register │ │ │ ├── post.json │ │ │ └── post.request.json │ │ └── get.json │ │ ├── files │ │ ├── calendar │ │ │ ├── test.bin │ │ │ │ ├── get.json │ │ │ │ ├── post.request.json │ │ │ │ ├── put.request.json │ │ │ │ ├── put.json │ │ │ │ └── post.json │ │ │ ├── test.txt │ │ │ │ ├── get.json │ │ │ │ ├── put.request.json │ │ │ │ ├── post.request.json │ │ │ │ ├── put.json │ │ │ │ ├── patch.json │ │ │ │ ├── delete.json │ │ │ │ ├── patch.request.json │ │ │ │ └── post.json │ │ │ ├── post.json │ │ │ ├── delete.json │ │ │ └── get.json │ │ └── get.json │ │ ├── email │ │ ├── post.json │ │ └── post.request.json │ │ └── get.json ├── app.config ├── packages.config ├── Properties │ └── AssemblyInfo.cs └── Api │ └── EmailApiTests.cs ├── .nuget ├── NuGet.exe └── NuGet.Config ├── favicon_32x32.png ├── DreamFactory.AddressBook ├── Views │ ├── _ViewStart.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _LoginPartial.cshtml │ │ ├── _Layout.cshtml │ │ └── Paging.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Manage │ │ └── ChangePassword.cshtml │ ├── ContactGroup │ │ └── List.cshtml │ └── Contact │ │ └── List.cshtml ├── favicon.ico ├── Global.asax ├── Scripts │ └── _references.js ├── App_Package │ ├── add_dotnet.dfpkg │ └── description.json ├── Images │ ├── profile-placeholder.png │ └── DreamFactory-logo-inverse-horiz.png ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── Models │ ├── Entities │ │ ├── InfoTypeEnum.cs │ │ ├── ContactContactGroup.cs │ │ └── ContactGroup.cs │ ├── ContactContactGroupViewModel.cs │ ├── ContactGroupViewModel.cs │ ├── ContactCreateViewModel.cs │ ├── ContactViewModel.cs │ ├── ContactInfoViewModel.cs │ ├── ManageViewModels.cs │ └── AccountViewModels.cs ├── Controllers │ └── HomeController.cs ├── App_Start │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ ├── DependencyConfig.cs │ ├── BundleConfig.cs │ └── DreamFactoryContext.cs ├── Startup.cs ├── Content │ └── Site.css ├── Global.asax.cs ├── Extensions │ └── Extensions.cs ├── Web.Debug.config ├── Properties │ └── AssemblyInfo.cs └── Web.Release.config ├── .travis.yml ├── DreamFactory ├── Model │ ├── User │ │ ├── Logout.cs │ │ ├── ProfileUpdateResponse.cs │ │ ├── RegisterResponse.cs │ │ ├── PasswordResponse.cs │ │ ├── Login.cs │ │ ├── PasswordRequest.cs │ │ ├── Register.cs │ │ ├── ProfileResponse.cs │ │ └── ProfileRequest.cs │ ├── System │ │ ├── Service │ │ │ ├── RelatedServiceDoc.cs │ │ │ └── ServiceRequest.cs │ │ ├── AppAppGroup │ │ │ └── RelatedAppToAppGroup.cs │ │ ├── Event │ │ │ ├── RelatedEventSubscriber.cs │ │ │ └── EventScriptRequest.cs │ │ ├── UserAppRole │ │ │ └── RelatedUserAppRole.cs │ │ ├── RoleServiceAccess │ │ │ └── RelatedRoleServiceAccess.cs │ │ ├── Custom │ │ │ └── CustomRequest.cs │ │ ├── AppGroup │ │ │ ├── AppGroupRequest.cs │ │ │ └── RelatedAppGroup.cs │ │ ├── Config │ │ │ ├── ConfigRequest.cs │ │ │ └── ConfigResponse.cs │ │ ├── Role │ │ │ └── RoleRequest.cs │ │ ├── Environment │ │ │ ├── PlatformSection.cs │ │ │ └── EnvironmentResponse.cs │ │ ├── Lookup │ │ │ └── LookupRequest.cs │ │ ├── Cors │ │ │ └── CorsRequest.cs │ │ ├── Setting │ │ │ └── RelatedSetting.cs │ │ └── Script │ │ │ └── RelatedScriptType.cs │ ├── IRecord.cs │ ├── Resource.cs │ ├── Email │ │ ├── EmailResponse.cs │ │ └── EmailAddress.cs │ ├── SuccessResponse.cs │ ├── ResourceWrapper.cs │ ├── Error.cs │ ├── RequestResourceWrapper.cs │ ├── Database │ │ ├── Metadata.cs │ │ ├── DatabaseResourceWrapper.cs │ │ ├── StoredProcRequest.cs │ │ ├── TableInfo.cs │ │ ├── TypeMap.cs │ │ ├── RelatedSchema.cs │ │ ├── StoredProcParam.cs │ │ └── TableSchema.cs │ ├── File │ │ ├── FileRequest.cs │ │ ├── ListingFlags.cs │ │ ├── FolderRequest.cs │ │ ├── FileResponse.cs │ │ ├── FolderResponse.cs │ │ └── StorageResource.cs │ └── Builder │ │ ├── IEmailRequestBuilder.cs │ │ └── IStoreProcParamsBuilder.cs ├── Rest │ ├── RestApiVersion.cs │ └── IRestContext.cs ├── Api │ ├── IEmailApi.cs │ ├── Implementation │ │ ├── EmailApi.cs │ │ ├── SystemApi.App.cs │ │ ├── SystemApi.User.cs │ │ ├── SystemApi.Role.cs │ │ ├── SystemApi.Cors.cs │ │ ├── SystemApi.Lookup.cs │ │ └── SystemApi.Service.cs │ ├── ISystemAdminApi.cs │ ├── ISystemEventApi.cs │ ├── ISystemRoleApi.cs │ ├── ISystemUserApi.cs │ ├── ISystemAppApi.cs │ ├── ISystemCorsApi.cs │ ├── ISystemServiceApi.cs │ └── ISystemLookupApi.cs ├── Http │ ├── IHttpFacade.cs │ ├── HttpMethod.cs │ ├── IHttpResponse.cs │ ├── IHttpRequest.cs │ ├── IHttpHeaders.cs │ ├── IHttpAddress.cs │ └── HttpResponse.cs ├── DreamFactoryException.cs ├── packages.config ├── Properties │ └── AssemblyInfo.cs └── Serialization │ └── IContentSerializer.cs ├── DreamFactory.Demo ├── IRunnable.cs ├── packages.config ├── App.config ├── Extensions.cs ├── Demo │ ├── LogoutDemo.cs │ ├── HttpDemo.cs │ ├── EmailDemo.cs │ ├── LoginDemo.cs │ ├── DiscoveryDemo.cs │ ├── FilesDemo.cs │ └── UserDemo.cs ├── Properties │ └── AssemblyInfo.cs └── Test │ └── SystemEventTest.cs ├── .gitattributes └── DreamFactoryNet.nuspec /DreamFactory.Tests/TestData/rest/db/_schema/put.json: -------------------------------------------------------------------------------- 1 | {"success":true} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/delete.json: -------------------------------------------------------------------------------- 1 | // Not used -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/Language/get.json: -------------------------------------------------------------------------------- 1 | en-us -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/post.json: -------------------------------------------------------------------------------- 1 | {"success":true} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.bin/get.json: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/get.json: -------------------------------------------------------------------------------- 1 | Hello -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/staff/delete.json: -------------------------------------------------------------------------------- 1 | {"success":true} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.bin/post.request.json: -------------------------------------------------------------------------------- 1 | ㌲㔴㜶㤸 -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.bin/put.request.json: -------------------------------------------------------------------------------- 1 | ㌲㔴㜶㤸 -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/put.request.json: -------------------------------------------------------------------------------- 1 | Bye -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/profile/post.json: -------------------------------------------------------------------------------- 1 | {"success": "true"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_func/get.json: -------------------------------------------------------------------------------- 1 | { "resource": [ "bar", "foo" ] } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_proc/get.json: -------------------------------------------------------------------------------- 1 | { "resource": [ "foo", "bar" ] } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/email/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1 3 | } 4 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/post.json: -------------------------------------------------------------------------------- 1 | // response is not used -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/post.request.json: -------------------------------------------------------------------------------- 1 | Hello -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/password/post.json: -------------------------------------------------------------------------------- 1 | {"success":"true"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password-complete/post.json: -------------------------------------------------------------------------------- 1 | {"success":true} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_proc/foo/get.json: -------------------------------------------------------------------------------- 1 | { "resource": [ "foo", "bar" ] } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/put.json: -------------------------------------------------------------------------------- 1 | // response is not used -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/1/get.json: -------------------------------------------------------------------------------- 1 | // fake package or SDK content -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/session/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": true 3 | } -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/patch.json: -------------------------------------------------------------------------------- 1 | // patch response is ignored -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/session/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": true 3 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password-reset/post.request.json: -------------------------------------------------------------------------------- 1 | {"email":"user@mail.com"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/delete.json: -------------------------------------------------------------------------------- 1 | // not used because of tunneling via POST -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/Language/patch.json: -------------------------------------------------------------------------------- 1 | {"name":"Language","value":"en-us"} -------------------------------------------------------------------------------- /favicon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/favicon_32x32.png -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/Language/patch.request.json: -------------------------------------------------------------------------------- 1 | {"name":"Language","value":"en-us"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password-reset/post.json: -------------------------------------------------------------------------------- 1 | {"security_question":"to be or not to be?"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password/post.request.json: -------------------------------------------------------------------------------- 1 | {"old_password":"abc","new_password":"cba"} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/register/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": true, 3 | "session_token": null 4 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "calendar/test.txt" 3 | } 4 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password/post.json: -------------------------------------------------------------------------------- 1 | {"security_question":"to be or not to be?","success":"true"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/staff/field/get.json: -------------------------------------------------------------------------------- 1 | { "name": "field", "type": "integer", "required": false } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/Language/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Language", 3 | "value": "en-us" 4 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: DreamFactoryNet.sln 3 | script: 4 | - xbuild DreamFactory/DreamFactory.csproj 5 | 6 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/password/post.request.json: -------------------------------------------------------------------------------- 1 | {"old_password":"oldPassword","new_password":"newPassword"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/session/post.request.json: -------------------------------------------------------------------------------- 1 | {"email":"demo@factory.com","password":"dreamfactory","duration":0} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/favicon.ico -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.bin/put.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test.bin", 3 | "path": "calendar/test.bin" 4 | } 5 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/patch.request.json: -------------------------------------------------------------------------------- 1 | {"name":"new.txt","path":"new.txt","content_type":"text/plain"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/session/post.request.json: -------------------------------------------------------------------------------- 1 | {"email":"dream@factory.com","password":"dreamfactory","duration":0} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/patch.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"name":"Language","value":"en-us"},{"name":"Language","value":"en-us"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/post.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"name":"Language","value":"en-us"},{"name":"Language","value":"en-us"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/password-complete/post.request.json: -------------------------------------------------------------------------------- 1 | {"new_password":"qwerty","email":"user@mail.com","security_answer":"maybe"} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="DreamFactory.AddressBook.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/delete.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":0,"first_name":"Andrei","last_name":"Smirnov","age":35,"active":true}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/config/post.request.json: -------------------------------------------------------------------------------- 1 | {"editable_profile_fields":"name","restricted_verbs":["patch"],"timestamp_format":""} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/email/post.request.json: -------------------------------------------------------------------------------- 1 | {"to":[{"email":"motodrug@gmail.com"}],"subject":"Hello from the demo!","body_text":"Hello, moto!"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.bin/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test.bin", 3 | "path": "calendar/test.bin", 4 | "type": "file" 5 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/test.txt/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test.txt", 3 | "path": "calendar/test.txt", 4 | "type": "file" 5 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"my_app_group","description":"Contains my groups."}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[0,1],"resource":[{"name":"Language","value":"en-us"},{"name":"TimeZone","value":"ET"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[0,1],"resource":[{"name":"Language","value":"en-us"},{"name":"TimeZone","value":"ET"}]} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/Scripts/_references.js -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/delete.request.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":0,"first_name":"Andrei","last_name":"Smirnov","age":35,"active":true}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"my_app_group","description":"Contains my groups."}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"First","value":"text","private":false,"description":"text"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"First","value":"text","private":false,"description":"text"}]} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Package/add_dotnet.dfpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/App_Package/add_dotnet.dfpkg -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/register/post.request.json: -------------------------------------------------------------------------------- 1 | {"email":"test@mail.com","first_name":"first","last_name":"last","name":"display","new_password":"qwerty"} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Images/profile-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/Images/profile-placeholder.png -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/config/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "editable_profile_fields": "name", 3 | "restricted_verbs": [ 4 | "patch" 5 | ], 6 | "timestamp_format": "" 7 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/config/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "editable_profile_fields": "name", 3 | "restricted_verbs": [ 4 | "patch" 5 | ], 6 | "timestamp_format": "" 7 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"AddressBookUser","description":"This role can access address book.","is_active":true}]} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"AddressBookUser","description":"This role can access address book.","is_active":true}]} -------------------------------------------------------------------------------- /DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_func/foo/post.request.json: -------------------------------------------------------------------------------- 1 | {"params":[{"name":"bar","param_type":"OUT","type":"string"},{"name":"foo","param_type":"OUT","type":"integer"}],"wrapper":"dataset"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_proc/foo/post.request.json: -------------------------------------------------------------------------------- 1 | {"params":[{"name":"bar","param_type":"OUT","type":"string"},{"name":"foo","param_type":"OUT","type":"integer"}],"wrapper":"dataset"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | "api_docs", 4 | "email", 5 | "files", 6 | "mongodb", 7 | "mysql", 8 | "system", 9 | "user" 10 | ] 11 | } -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Images/DreamFactory-logo-inverse-horiz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/HEAD/DreamFactory.AddressBook/Images/DreamFactory-logo-inverse-horiz.png -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"dreamUser","first_name":"Dream","last_name":"Factory","email":"system@factory.com","is_active":true}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"dreamUser","first_name":"Dream","last_name":"Factory","email":"system@factory.com","is_active":true}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/email_template/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null,null,null],"resource":[{"name":"User Invite Default"},{"name":"User Registration Default"},{"name":"Password Reset Default"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/patch.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":2,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":3,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/email_template/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1,2,3],"resource":[{"id":1,"name":"User Invite Default"},{"id":2,"name":"User Registration Default"},{"id":3,"name":"Password Reset Default"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"system","label":"System Management","description":"Service for managing system resources.","is_active":true,"type":"system"}]} -------------------------------------------------------------------------------- /DreamFactory/Model/User/Logout.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | /// 4 | /// Logout. 5 | /// 6 | public class Logout : SuccessResponse 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/patch.request.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":0,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":0,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"system","label":"System Management","description":"Service for managing system resources.","is_active":true,"type":"system"}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null,null],"resource":[{"path":"http://domain.foo","origin":"http://domain.foo","enabled":true},{"path":"http://domain.bar","origin":"http://domain.bar","enabled":true}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/profile/post.request.json: -------------------------------------------------------------------------------- 1 | {"email":"alex@user.com","first_name":"Alex","last_name":"Smith","display_name":"Alex Smith","security_question":"to be or not to be?","default_app_id":1,"security_answer":"maybe"} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/event/system.get.pre_process/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my_custom_script", 3 | "type": "v8js", 4 | "is_active": true, 5 | "affects_process": true, 6 | "content": "text", 7 | "config": "text" 8 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Package/description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Address Book with ASP.NET", 3 | "description": "An address book app with ASP.NET showing user registration, user login, and CRUD.", 4 | "type": 0, 5 | "active": true 6 | } 7 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1,2],"resource":[{"id":1,"path":"http://domain.foo","origin":"http://domain.foo","enabled":true},{"id":2,"path":"http://domain.bar","origin":"http://domain.bar","enabled":true}]} -------------------------------------------------------------------------------- /DreamFactory/Model/System/Service/RelatedServiceDoc.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Service 2 | { 3 | /// 4 | /// RelatedServiceDoc. 5 | /// 6 | public class RelatedServiceDoc 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory.Demo/IRunnable.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo 2 | { 3 | using System.Threading.Tasks; 4 | using DreamFactory.Rest; 5 | 6 | internal interface IRunnable 7 | { 8 | Task RunAsync(IRestContext context); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/AppAppGroup/RelatedAppToAppGroup.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.AppAppGroup 2 | { 3 | /// 4 | /// AppToAppGroup 5 | /// 6 | public class RelatedAppToAppGroup 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory/Model/IRecord.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | internal interface IRecord 4 | { 5 | /// 6 | /// Identifier of this record. 7 | /// 8 | int? Id { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Event/RelatedEventSubscriber.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Event 2 | { 3 | /// 4 | /// RelatedEventSubscriber. 5 | /// 6 | public class RelatedEventSubscriber 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/UserAppRole/RelatedUserAppRole.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.UserAppRole 2 | { 3 | /// 4 | /// RelatedUserAppRole. 5 | /// 6 | public class RelatedUserAppRole 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_func/foo/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "dataset": [{"uid":1,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":2,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}], 3 | "foo": 123, 4 | "bar": "test" 5 | } 6 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_proc/foo/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "dataset": [{"uid":1,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":2,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}], 3 | "foo": 123, 4 | "bar": "test" 5 | } 6 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/post.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[null],"resource":[{"name":"admin","description":"An application for administering this instance.","is_active":true,"requires_fullscreen":false,"allow_fullscreen_toggle":true,"toggle_location":"top","role_id":2}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/event/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | "system.get.pre_process", 4 | "system.get.post_process", 5 | "system.admin.get.pre_process", 6 | "system.admin.get.post_process", 7 | "system.admin.post.pre_process" 8 | ] 9 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "_schema" 5 | }, 6 | { 7 | "name": "_table" 8 | }, 9 | { 10 | "name": "_proc" 11 | }, 12 | { 13 | "name": "_func" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app/patch.request.json: -------------------------------------------------------------------------------- 1 | {"ids":[1],"resource":[{"id":1,"name":"admin","description":"An application for administering this instance.","is_active":true,"requires_fullscreen":false,"allow_fullscreen_toggle":true,"toggle_location":"top","role_id":2}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/post.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":1,"first_name":"Andrei","last_name":"Smirnov","age":35,"active":true},{"uid":2,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":3,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/profile/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "first_name": "Andrei", 3 | "last_name": "Smirnov", 4 | "name": "pinebit", 5 | "email": "pinebit@gmail.com", 6 | "phone": "+79213913541", 7 | "security_question": null, 8 | "default_app_id": 2 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/RoleServiceAccess/RelatedRoleServiceAccess.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.RoleServiceAccess 2 | { 3 | /// 4 | /// RelatedRoleServiceAccess. 5 | /// 6 | public class RelatedRoleServiceAccess 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/staff/post.request.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"uid":0,"first_name":"Andrei","last_name":"Smirnov","age":35,"active":true},{"uid":0,"first_name":"Mike","last_name":"Meyers","age":33,"active":false},{"uid":0,"first_name":"Selena","last_name":"Gomez","age":24,"active":false}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "password" 5 | }, 6 | { 7 | "name": "profile" 8 | }, 9 | { 10 | "name": "register" 11 | }, 12 | { 13 | "name": "session" 14 | }, 15 | { 16 | "name": "custom" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/Entities/InfoTypeEnum.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models.Entities 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public enum InfoType 6 | { 7 | work, 8 | home, 9 | mobile, 10 | other 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ContactContactGroupViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | public class ContactContactGroupViewModel 4 | { 5 | public int ContactId { get; set; } 6 | public bool InGroup { get; set; } 7 | public string ContactName { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Controllers 2 | { 3 | using System.Web.Mvc; 4 | 5 | [HandleError] 6 | public class HomeController : Controller 7 | { 8 | public ActionResult Index() 9 | { 10 | return View(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace DreamFactory.AddressBok 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/post.request.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"name":"staff","field":[{"name":"Uid","type":"id","required":true,"auto_increment":true,"is_primary_key":true},{"name":"FirstName","type":"string","required":false},{"name":"LastName","type":"string","required":false},{"name":"Age","type":"integer","required":false},{"name":"Active","type":"boolean","required":false}]}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/put.request.json: -------------------------------------------------------------------------------- 1 | {"resource":[{"name":"staff","field":[{"name":"Uid","type":"id","required":true,"auto_increment":true,"is_primary_key":true},{"name":"FirstName","type":"string","required":false},{"name":"LastName","type":"string","required":false},{"name":"Age","type":"integer","required":false},{"name":"Active","type":"boolean","required":false}]}]} -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/constant/content_types/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "content_types": { 3 | "JSON": 0, 4 | "XML": 1, 5 | "CSV": 3, 6 | "PSV": 4, 7 | "TSV": 5, 8 | "HTML": 6, 9 | "TEXT": 7, 10 | "JAVASCRIPT": 8, 11 | "CSS": 9, 12 | "RDF": 10, 13 | "PDF": 11, 14 | "ATOM": 12, 15 | "RSS": 13, 16 | "WWW": 14 17 | } 18 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "path": "http://domain.foo", 6 | "origin": "http://domain.foo", 7 | "enabled": true 8 | }, 9 | { 10 | "id": 2, 11 | "path": "http://domain.bar", 12 | "origin": "http://domain.bar", 13 | "enabled": true 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "path": "http://domain.foo", 6 | "origin": "http://domain.foo", 7 | "enabled": true 8 | }, 9 | { 10 | "id": 2, 11 | "path": "http://domain.bar", 12 | "origin": "http://domain.bar", 13 | "enabled": true 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "path": "http://domain.foo", 6 | "origin": "http://domain.foo", 7 | "enabled": true 8 | }, 9 | { 10 | "id": 2, 11 | "path": "http://domain.bar", 12 | "origin": "http://domain.bar", 13 | "enabled": true 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/cors/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "path": "http://domain.foo", 6 | "origin": "http://domain.foo", 7 | "enabled": true 8 | }, 9 | { 10 | "id": 2, 11 | "path": "http://domain.bar", 12 | "origin": "http://domain.bar", 13 | "enabled": true 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "my_app_group", 6 | "description": "Contains my groups.", 7 | "created_date": "2015-09-02 19:42:45", 8 | "last_modified_date": "2015-09-02 19:42:45", 9 | "created_by_id": 1, 10 | "last_modified_by_id": null 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "my_app_group", 6 | "description": "Contains my groups.", 7 | "created_date": "2015-09-02 19:42:45", 8 | "last_modified_date": "2015-09-02 19:42:45", 9 | "created_by_id": 1, 10 | "last_modified_by_id": null 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "my_app_group", 6 | "description": "Contains my groups.", 7 | "created_date": "2015-09-02 19:42:45", 8 | "last_modified_date": "2015-09-02 19:42:45", 9 | "created_by_id": 1, 10 | "last_modified_by_id": null 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/app_group/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "my_app_group", 6 | "description": "Contains my groups.", 7 | "created_date": "2015-09-02 19:42:45", 8 | "last_modified_date": "2015-09-02 19:42:45", 9 | "created_by_id": 1, 10 | "last_modified_by_id": null 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/event/system.get.pre_process/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my_custom_script", 3 | "type": "v8js", 4 | "is_active": true, 5 | "affects_process": true, 6 | "content": "text", 7 | "config": "text", 8 | "created_date": "2015-08-31 18:14:09", 9 | "last_modified_date": "2015-08-31 18:14:09", 10 | "created_by_id": 1, 11 | "last_modified_by_id": null 12 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/event/system.get.pre_process/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my_custom_script", 3 | "type": "v8js", 4 | "is_active": true, 5 | "affects_process": true, 6 | "content": "text", 7 | "config": "text", 8 | "created_date": "2015-08-31 18:14:09", 9 | "last_modified_date": "2015-08-31 18:14:09", 10 | "created_by_id": 1, 11 | "last_modified_by_id": null 12 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ContactGroupViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.Collections.Generic; 4 | using DreamFactory.AddressBook.Models.Entities; 5 | 6 | public class ContactGroupViewModel 7 | { 8 | public ContactGroup ContactGroup { get; set; } 9 | public List Contacts { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DreamFactory.Demo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_schema/staff/get.json: -------------------------------------------------------------------------------- 1 | {"name":"staff","field":[{"name":"uid","type":"integer","required":false},{"name":"first_name","type":"string","required":false},{"name":"last_name","type":"string","required":false},{"name":"age","type":"integer","required":false},{"name":"active","type":"boolean","required":false},{"name":"uid","type":"id","required":true,"auto_increment":true,"is_primary_key":true}]} -------------------------------------------------------------------------------- /DreamFactory/Model/Resource.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Resource. 7 | /// 8 | public class Resource 9 | { 10 | /// 11 | /// Name of the resource. 12 | /// 13 | [JsonProperty(PropertyName = "name")] 14 | public string Name { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "AddressBookUser", 6 | "description": "This role can access address book.", 7 | "is_active": true, 8 | "created_date": "2015-09-02 19:56:35", 9 | "last_modified_date": "2015-09-02 19:56:35", 10 | "created_by_id": 1, 11 | "last_modified_by_id": null 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/lookup/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "First lookup second time", 6 | "value": "text", 7 | "private": false, 8 | "description": "text", 9 | "created_date": "2015-09-22 10:19:24", 10 | "last_modified_date": "2015-09-22 10:20:04", 11 | "created_by_id": 1, 12 | "last_modified_by_id": 1 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "AddressBookUser", 6 | "description": "This role can access address book.", 7 | "is_active": true, 8 | "created_date": "2015-09-02 19:56:35", 9 | "last_modified_date": "2015-09-02 19:56:35", 10 | "created_by_id": 1, 11 | "last_modified_by_id": null 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "AddressBookUser", 6 | "description": "This role can access address book.", 7 | "is_active": true, 8 | "created_date": "2015-09-02 19:56:35", 9 | "last_modified_date": "2015-09-02 19:56:35", 10 | "created_by_id": 1, 11 | "last_modified_by_id": null 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /DreamFactory/Rest/RestApiVersion.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Rest 2 | { 3 | /// 4 | /// Defines REST API versions. 5 | /// 6 | public enum RestApiVersion 7 | { 8 | /// 9 | /// First version: /rest/... 10 | /// 11 | V1, 12 | 13 | /// 14 | /// Next version: /api/v2/... 15 | /// 16 | V2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/script_type/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "v8js", 5 | "class_name": "DreamFactory\\Core\\Scripting\\Engines\\V8Js", 6 | "label": "V8Js", 7 | "description": "Server-side JavaScript handler using the V8Js engine.", 8 | "sandboxed": true, 9 | "created_date": "2015-08-24 22:27:07", 10 | "last_modified_date": "2015-08-24 22:27:07" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /DreamFactory/Model/Email/EmailResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Email 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Email response. 7 | /// 8 | public class EmailResponse 9 | { 10 | /// 11 | /// Number of emails successfully sent. 12 | /// 13 | [JsonProperty(PropertyName = "count")] 14 | public int? Count { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /DreamFactory/Model/SuccessResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Success response. 7 | /// 8 | public class SuccessResponse 9 | { 10 | /// 11 | /// Indicator whether request was successful. 12 | /// 13 | [JsonProperty(PropertyName = "success")] 14 | public bool? Success { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DreamFactory.Tests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DreamFactory/Model/User/ProfileUpdateResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// ProfileUpdateResponse. 7 | /// 8 | public class ProfileUpdateResponse 9 | { 10 | /// 11 | /// Indicator whether updating profile was successful. 12 | /// 13 | [JsonProperty(PropertyName = "success")] 14 | public bool? Success { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DreamFactory.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DreamFactory/Model/ResourceWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Wrapper for resources. 8 | /// 9 | /// Type of the records. 10 | public class ResourceWrapper 11 | { 12 | /// 13 | /// Collection of records. 14 | /// 15 | [JsonProperty(PropertyName = "resource")] 16 | public List Records { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "system", 6 | "label": "System Management", 7 | "description": "Service for managing system resources.", 8 | "is_active": true, 9 | "type": "system", 10 | "mutable": false, 11 | "deletable": false, 12 | "created_date": "2015-08-24 22:27:07", 13 | "last_modified_date": "2015-08-24 22:27:07", 14 | "created_by_id": null, 15 | "last_modified_by_id": null, 16 | "config": [] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "system", 6 | "label": "System Management", 7 | "description": "Service for managing system resources.", 8 | "is_active": true, 9 | "type": "system", 10 | "mutable": false, 11 | "deletable": false, 12 | "created_date": "2015-08-24 22:27:07", 13 | "last_modified_date": "2015-08-24 22:27:07", 14 | "created_by_id": null, 15 | "last_modified_by_id": null, 16 | "config": [] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /DreamFactory/Api/IEmailApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using System.Threading.Tasks; 4 | using DreamFactory.Model.Email; 5 | 6 | /// 7 | /// Represents /email API. 8 | /// 9 | public interface IEmailApi 10 | { 11 | /// 12 | /// Sends email(s). 13 | /// 14 | /// instance. 15 | /// Number of emails successfully sent. 16 | Task SendEmailAsync(EmailRequest emailRequest); 17 | } 18 | } -------------------------------------------------------------------------------- /DreamFactory/Http/IHttpFacade.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | using System.Threading.Tasks; 4 | 5 | /// 6 | /// Represents stateless HTTP facade. 7 | /// 8 | public interface IHttpFacade 9 | { 10 | /// 11 | /// Sends HTTP request to receive body as string. 12 | /// 13 | /// instance. 14 | /// instance. 15 | Task RequestAsync(IHttpRequest request); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DreamFactory/Model/Error.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Error data. 7 | /// 8 | public class Error 9 | { 10 | /// 11 | /// Gets error message. 12 | /// 13 | [JsonProperty(PropertyName = "message")] 14 | public string Message { get; set; } 15 | 16 | /// 17 | /// Gets HTTP status code. 18 | /// 19 | [JsonProperty(PropertyName = "code")] 20 | public int Code { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory/Model/RequestResourceWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Wrapper for request resources. 8 | /// 9 | /// Type of the records. 10 | public class RequestResourceWrapper : ResourceWrapper 11 | { 12 | /// 13 | /// Collection of identifiers. 14 | /// 15 | [JsonProperty(PropertyName = "ids")] 16 | public int?[] Ids { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DreamFactory.Demo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /DreamFactory/DreamFactoryException.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory 2 | { 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// DreamFactoryException. 8 | /// 9 | [DataContract] 10 | public class DreamFactoryException : Exception 11 | { 12 | /// 13 | public DreamFactoryException(string message) : base(message) 14 | { 15 | } 16 | 17 | /// 18 | public DreamFactoryException(string message, Exception inner) : base(message, inner) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /DreamFactory/Model/User/RegisterResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Register response. 7 | /// 8 | public class RegisterResponse : SuccessResponse 9 | { 10 | /// 11 | /// Token for the current session, used in X-DreamFactory-Session-Token header for API requests. 12 | /// SessionToken has value only if request had parameter login set to true. 13 | /// 14 | [JsonProperty(PropertyName = "session_token")] 15 | public string SessionToken { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/Metadata.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Query metadata class. 7 | /// 8 | public class QueryMetadata 9 | { 10 | /// 11 | /// Queried table schema. 12 | /// 13 | [JsonProperty(PropertyName = "schema")] 14 | public TableSchema Schema { get; set; } 15 | 16 | /// 17 | /// Records total count. 18 | /// 19 | [JsonProperty(PropertyName = "count")] 20 | public int? Count { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ContactCreateViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Web; 5 | using DreamFactory.AddressBook.Models.Entities; 6 | 7 | public class ContactCreateViewModel 8 | { 9 | public int? GroupId { get; set; } 10 | 11 | [Display(Name = "Image URL")] 12 | public HttpPostedFileBase ImageUpload { get; set; } 13 | 14 | public Contact Contact { get; set; } 15 | 16 | public ContactInfoViewModel ContactInfoViewModel { get; set; } 17 | public string ImageData { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DreamFactory/Model/Email/EmailAddress.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Email 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Email address. 7 | /// 8 | public class EmailAddress 9 | { 10 | /// 11 | /// Optional name displayed along with the email address. 12 | /// 13 | [JsonProperty(PropertyName = "name")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Required email address. 18 | /// 19 | [JsonProperty(PropertyName = "email")] 20 | public string Email { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ContactViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Web; 6 | using DreamFactory.AddressBook.Models.Entities; 7 | 8 | public class ContactViewModel 9 | { 10 | public int? GroupId { get; set; } 11 | 12 | [Display(Name = "Image URL")] 13 | public HttpPostedFileBase ImageUpload { get; set; } 14 | 15 | public Contact Contact { get; set; } 16 | 17 | public List ContactInfos { get; set; } 18 | public string ImageData { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DreamFactory/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "dreamUser", 6 | "first_name": "Dream", 7 | "last_name": "Factory", 8 | "last_login_date": null, 9 | "email": "system@factory.com", 10 | "is_active": true, 11 | "phone": null, 12 | "security_question": null, 13 | "confirm_code": null, 14 | "default_app_id": null, 15 | "adldap": null, 16 | "oauth_provider": null, 17 | "created_date": "2015-09-02 19:55:09", 18 | "last_modified_date": "2015-09-02 19:55:09", 19 | "created_by_id": 1, 20 | "last_modified_by_id": null 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "dreamUser", 6 | "first_name": "Dream", 7 | "last_name": "Factory", 8 | "last_login_date": null, 9 | "email": "system@factory.com", 10 | "is_active": true, 11 | "phone": null, 12 | "security_question": null, 13 | "confirm_code": null, 14 | "default_app_id": null, 15 | "adldap": null, 16 | "oauth_provider": null, 17 | "created_date": "2015-09-02 19:55:09", 18 | "last_modified_date": "2015-09-02 19:55:09", 19 | "created_by_id": 1, 20 | "last_modified_by_id": null 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "dreamUser", 6 | "first_name": "Dream", 7 | "last_name": "Factory", 8 | "last_login_date": null, 9 | "email": "system@factory.com", 10 | "is_active": true, 11 | "phone": null, 12 | "security_question": null, 13 | "confirm_code": null, 14 | "default_app_id": null, 15 | "adldap": null, 16 | "oauth_provider": null, 17 | "created_date": "2015-09-02 19:55:09", 18 | "last_modified_date": "2015-09-02 19:55:09", 19 | "created_by_id": 1, 20 | "last_modified_by_id": null 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Owin; 5 | 6 | [assembly: OwinStartup(typeof(DreamFactory.AddressBook.Startup))] 7 | 8 | namespace DreamFactory.AddressBook 9 | { 10 | using Microsoft.Owin.Security.Cookies; 11 | 12 | public class Startup 13 | { 14 | public void Configuration(IAppBuilder app) 15 | { 16 | app.UseCookieAuthentication(new CookieAuthenticationOptions 17 | { 18 | AuthenticationType = CookieAuthenticationDefaults.AuthenticationType, 19 | LoginPath = new PathString("/") 20 | }); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/DatabaseResourceWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Wrapper for database response resources. 7 | /// 8 | /// Type of the records. 9 | public class DatabaseResourceWrapper : ResourceWrapper 10 | { 11 | /// 12 | /// Metadata for requested resources. 13 | /// 14 | /// Property is populated only if request query contained IncludeSchema or IncludeCount parameter. 15 | [JsonProperty(PropertyName = "meta")] 16 | public QueryMetadata Meta { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace DreamFactory.AddressBok 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DreamFactory/Http/HttpMethod.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | /// 4 | /// Defines supported HTTP methods. 5 | /// 6 | public enum HttpMethod 7 | { 8 | /// 9 | /// HTTP GET. 10 | /// 11 | Get, 12 | 13 | /// 14 | /// HTTP POST. 15 | /// 16 | Post, 17 | 18 | /// 19 | /// HTTP PUT. 20 | /// 21 | Put, 22 | 23 | /// 24 | /// HTTP PATCH. 25 | /// 26 | Patch, 27 | 28 | /// 29 | /// HTTP DELETE. 30 | /// 31 | Delete 32 | } 33 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ContactInfoViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using DreamFactory.AddressBook.Models.Entities; 5 | using DreamFactory.AddressBook.Properties; 6 | 7 | public class ContactInfoViewModel 8 | { 9 | public string ReturnUrl { get; set; } 10 | 11 | [Display(Name = "Contact info type")] 12 | [Required(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessage_Required", ErrorMessage = null)] 13 | public InfoType InfoType { get; set; } 14 | 15 | public ContactInfo ContactInfo { get; set; } 16 | 17 | public string ContactName { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/role/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "AddressBookUser", 6 | "description": "This role can access address book.", 7 | "is_active": true, 8 | "created_date": "2015-08-24 22:29:52", 9 | "last_modified_date": "2015-08-24 22:54:19", 10 | "created_by_id": 1, 11 | "last_modified_by_id": 1 12 | }, 13 | { 14 | "id": 2, 15 | "name": "DemoUser", 16 | "description": "This role can access demo app.", 17 | "is_active": true, 18 | "created_date": "2015-08-24 22:30:16", 19 | "last_modified_date": "2015-08-27 05:24:24", 20 | "created_by_id": 1, 21 | "last_modified_by_id": 1 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /DreamFactory.Demo/Extensions.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Newtonsoft.Json; 7 | 8 | internal static class Extensions 9 | { 10 | public static string ToStringList(this IEnumerable list) 11 | { 12 | string temp = string.Join(", ", list.Where(x => !string.IsNullOrEmpty(x))); 13 | return String.Format("[{0}]", temp); 14 | } 15 | 16 | public static TTarget Convert(this TSource src) 17 | { 18 | string json = JsonConvert.SerializeObject(src); 19 | return JsonConvert.DeserializeObject(json); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory/Http/IHttpResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | /// 4 | /// Represents HTTP response. 5 | /// 6 | public interface IHttpResponse 7 | { 8 | /// 9 | /// Gets the corresponding request instance. 10 | /// 11 | IHttpRequest Request { get; } 12 | 13 | /// 14 | /// Gets HTTP status code. 15 | /// 16 | int Code { get; } 17 | 18 | /// 19 | /// Gets HTTP response body. 20 | /// 21 | string Body { get; } 22 | 23 | /// 24 | /// Gets raw bytes of body. 25 | /// 26 | byte[] RawBody { get; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/LogoutDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Api; 6 | using DreamFactory.Rest; 7 | 8 | public class LogoutDemo : IRunnable 9 | { 10 | public async Task RunAsync(IRestContext context) 11 | { 12 | ISystemApi systemApi = context.Factory.CreateSystemApi(); 13 | bool success = await systemApi.LogoutAdminAsync(); 14 | Console.WriteLine("Logged out, success={0}", success); 15 | 16 | //IUserApi userApi = context.Factory.CreateUserApi(); 17 | //bool success = await userApi.LogoutAsync(); 18 | //Console.WriteLine("Logged out, success={0}", success); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /DreamFactory/Model/User/PasswordResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// PasswordResponse. 7 | /// 8 | public class PasswordResponse 9 | { 10 | /// 11 | /// User's security question, returned on reset request when no email confirmation required. 12 | /// 13 | [JsonProperty(PropertyName = "security_question")] 14 | public string SecurityQuestion { get; set; } 15 | 16 | /// 17 | /// True if password updated or reset request granted via email confirmation. 18 | /// 19 | [JsonProperty(PropertyName = "success")] 20 | public bool? Success { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | 26 | .checkbox-list { 27 | overflow-y: auto; 28 | max-height:280px; 29 | max-width: 280px; 30 | height:auto !important; 31 | height:280px; 32 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/Entities/ContactContactGroup.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models.Entities 2 | { 3 | using Newtonsoft.Json; 4 | 5 | public class ContactContactGroup 6 | { 7 | [JsonProperty(PropertyName = "id")] 8 | public int? Id { get; set; } 9 | 10 | [JsonProperty(PropertyName = "contact_id")] 11 | public int? ContactId { get; set; } 12 | 13 | [JsonProperty(PropertyName = "contact_group_id")] 14 | public int? ContactGroupId { get; set; } 15 | 16 | [JsonProperty(PropertyName = "contact_by_contact_id")] 17 | public Contact Contact { get; set; } 18 | 19 | [JsonProperty(PropertyName = "contact_group_by_contact_group_id")] 20 | public ContactGroup ContactGroup { get; set; } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/StoredProcRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Stored procedure request. 8 | /// 9 | public class StoredProcRequest 10 | { 11 | /// 12 | /// Optional array of input and output parameters. 13 | /// 14 | [JsonProperty(PropertyName = "params")] 15 | public List Params { get; set; } 16 | 17 | /// 18 | /// Add this wrapper around the expected data set before returning, same as URL parameter. 19 | /// 20 | [JsonProperty(PropertyName = "wrapper")] 21 | public string Wrapper { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/custom/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "preferences", 5 | "value": "text", 6 | "created_date": "2015-08-28 22:53:42", 7 | "last_modified_date": "2015-08-28 22:53:42", 8 | "created_by_id": 1, 9 | "last_modified_by_id": null 10 | }, 11 | { 12 | "name": "Language", 13 | "value": "en-us", 14 | "created_date": "2015-08-28 22:56:03", 15 | "last_modified_date": "2015-08-28 22:56:03", 16 | "created_by_id": 1, 17 | "last_modified_by_id": null 18 | }, 19 | { 20 | "name": "TimeZone", 21 | "value": "ET", 22 | "created_date": "2015-08-28 23:07:57", 23 | "last_modified_date": "2015-08-28 23:07:57", 24 | "created_by_id": 1, 25 | "last_modified_by_id": null 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /DreamFactory/Model/User/Login.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Login. 7 | /// 8 | public class Login 9 | { 10 | /// 11 | /// e-mail. 12 | /// 13 | [JsonProperty(PropertyName = "email")] 14 | public string Email { get; set; } 15 | 16 | /// 17 | /// Password. 18 | /// 19 | [JsonProperty(PropertyName = "password")] 20 | public string Password { get; set; } 21 | 22 | /// 23 | /// Duration of the session, Defaults to 0, which means until browser is closed. 24 | /// 25 | [JsonProperty(PropertyName = "duration")] 26 | public int? Duration { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Global.asax.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook 2 | { 3 | using System.Security.Claims; 4 | using System.Web.Helpers; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | using DreamFactory.AddressBok; 9 | 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 16 | RouteConfig.RegisterRoutes(RouteTable.Routes); 17 | BundleConfig.RegisterBundles(BundleTable.Bundles); 18 | DependencyConfig.Initialize(); 19 | AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Custom/CustomRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Custom 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// CustomRequest. 7 | /// 8 | public class CustomRequest 9 | { 10 | /// 11 | /// Id of the user linked to custom setting. 12 | /// 13 | [JsonProperty(PropertyName = "user_id")] 14 | public int? UserId { get; set; } 15 | 16 | /// 17 | /// Name of the resource. 18 | /// 19 | [JsonProperty(PropertyName = "name")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Value of the resource. 24 | /// 25 | [JsonProperty(PropertyName = "value")] 26 | public string Value { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/db/_table/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "Events", 5 | "label": "Events", 6 | "plural": "Events", 7 | "access": [ 8 | "GET", 9 | "POST", 10 | "PUT", 11 | "PATCH", 12 | "MERGE", 13 | "DELETE" 14 | ] 15 | }, 16 | { 17 | "name": "staff", 18 | "label": "Staff", 19 | "plural": "Staffs", 20 | "access": [ 21 | "GET", 22 | "POST", 23 | "PUT", 24 | "PATCH", 25 | "MERGE", 26 | "DELETE" 27 | ] 28 | }, 29 | { 30 | "name": "todo", 31 | "label": "Todo", 32 | "plural": "Todos", 33 | "access": [ 34 | "GET", 35 | "POST", 36 | "PUT", 37 | "PATCH", 38 | "MERGE", 39 | "DELETE" 40 | ] 41 | } 42 | ] 43 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/AppGroup/AppGroupRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.AppGroup 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// AppGroupResponse. 7 | /// 8 | public class AppGroupRequest : IRecord 9 | { 10 | /// 11 | /// Identifier of this application group. 12 | /// 13 | [JsonProperty(PropertyName = "id")] 14 | public int? Id { get; set; } 15 | 16 | /// 17 | /// Displayable name of this application group. 18 | /// 19 | [JsonProperty(PropertyName = "name")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Description of this application group. 24 | /// 25 | [JsonProperty(PropertyName = "description")] 26 | public string Description { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /DreamFactory/Model/File/FileRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// FileRequest. 7 | /// 8 | public class FileRequest 9 | { 10 | /// 11 | /// Gets Identifier/Name for the file, localized to requested resource. 12 | /// 13 | [JsonProperty(PropertyName = @"name")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Full path of the file, from the service including container. 18 | /// 19 | [JsonProperty(PropertyName = "path")] 20 | public string Path { get; set; } 21 | 22 | /// 23 | /// The media type of the content of the file. 24 | /// 25 | [JsonProperty(PropertyName = "content_type")] 26 | public string ContentType { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/session/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "session_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 3 | "session_id": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 4 | "id": 1, 5 | "name": "SuperAdmin", 6 | "first_name": "sa", 7 | "last_name": "sa", 8 | "email": "dream@factory.com", 9 | "is_sys_admin": true, 10 | "last_login_date": "2015-08-31 20:28:45" 11 | } 12 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/admin/session/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "session_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 3 | "session_id": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 4 | "id": 1, 5 | "name": "SuperAdmin", 6 | "first_name": "sa", 7 | "last_name": "sa", 8 | "email": "dream@factory.com", 9 | "is_sys_admin": true, 10 | "last_login_date": "2015-08-31 20:28:45" 11 | } 12 | -------------------------------------------------------------------------------- /DreamFactory/Http/IHttpRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | /// 4 | /// Represents HTTP request. 5 | /// 6 | public interface IHttpRequest 7 | { 8 | /// 9 | /// Gets HTTP method. 10 | /// 11 | HttpMethod Method { get; } 12 | 13 | /// 14 | /// Gets Url. 15 | /// 16 | string Url { get; } 17 | 18 | /// 19 | /// Gets request headers. 20 | /// 21 | IHttpHeaders Headers { get; } 22 | 23 | /// 24 | /// Gets body content. 25 | /// 26 | string Body { get; } 27 | 28 | /// 29 | /// Sets tunneling mode. 30 | /// 31 | /// HTTP method for tunneling. 32 | void SetTunnelingWith(HttpMethod method); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Extensions/Extensions.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Extensions 2 | { 3 | using System; 4 | using System.Collections.Specialized; 5 | using System.Linq; 6 | using System.Web.Routing; 7 | 8 | public static class Extensions 9 | { 10 | public static RouteValueDictionary ToRouteValues(this NameValueCollection col, Object obj = null) 11 | { 12 | string[] skip = { "offset", "limit" }; 13 | 14 | var values = new RouteValueDictionary(obj); 15 | if (col != null) 16 | { 17 | foreach (string key in col) 18 | { 19 | //values passed in object override those already in collection 20 | if (!values.ContainsKey(key) && !skip.Contains(key.ToLowerInvariant())) values[key] = col[key]; 21 | } 22 | } 23 | return values; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/session/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "session_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDEyOTUzODMiLCJleHAiOiIxNDQxMjk4OTgzIiwibmJmIjoiMTQ0MTI5NTM4MyIsImp0aSI6IjdkZTM4YzU4YTc4YzNjZGQzZDczODUxYzIyNGY2NjkyIn0.7JIFgTrEIzPl83UTMl1aA4aUalwdTU42T9LTxWm3CcI", 3 | "session_id": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDEyOTUzODMiLCJleHAiOiIxNDQxMjk4OTgzIiwibmJmIjoiMTQ0MTI5NTM4MyIsImp0aSI6IjdkZTM4YzU4YTc4YzNjZGQzZDczODUxYzIyNGY2NjkyIn0.7JIFgTrEIzPl83UTMl1aA4aUalwdTU42T9LTxWm3CcI", 4 | "id": 2, 5 | "name": "demo", 6 | "first_name": "demo", 7 | "last_name": "demo", 8 | "email": "demo@factory.com", 9 | "is_sys_admin": false, 10 | "last_login_date": "2015-09-03 15:49:42", 11 | "role": "DemoUser", 12 | "role_id": 2 13 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/user/session/post.json: -------------------------------------------------------------------------------- 1 | { 2 | "session_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 3 | "session_id": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsInVzZXJfaWQiOjIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODc2NVwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDA2MTk0NDUiLCJleHAiOiIxNDQwNjIzMDQ1IiwibmJmIjoiMTQ0MDYxOTQ0NSIsImp0aSI6ImU4ZDhmOWJlOGVkYzk2ZTY5ZDdhZGVmYWVmNDNjNmJhIn0.-DyPDFqmqhKWs0qNTjg5lHQeNyoN9TMPRHMRiSEVVt0", 4 | "id": 2, 5 | "name": "demo", 6 | "first_name": "demo", 7 | "last_name": "demo", 8 | "email": "demo@factory.com", 9 | "is_sys_admin": false, 10 | "last_login_date": "2015-08-26 20:04:05", 11 | "role": "DemoUser", 12 | "role_id": 2 13 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if (Request.IsAuthenticated) 2 | { 3 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 4 | { 5 | @Html.AntiForgeryToken() 6 | 7 | 13 | } 14 | } 15 | else 16 | { 17 | 21 | } 22 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/HttpDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Rest; 7 | 8 | public class HttpDemo : IRunnable 9 | { 10 | public async Task RunAsync(IRestContext context) 11 | { 12 | /* 13 | * Get random bytes as hex string from random.org 14 | */ 15 | 16 | const string url = "https://www.random.org/cgi-bin/randbyte?nbytes=16&format=h"; 17 | IHttpRequest request = new HttpRequest(HttpMethod.Get, url, new HttpHeaders()); 18 | IHttpFacade httpFacade = new UnirestHttpFacade(); 19 | 20 | Console.WriteLine("Sending GET request: {0}", url); 21 | IHttpResponse response = await httpFacade.RequestAsync(request); 22 | 23 | Console.WriteLine("Response CODE = {0}, BODY = {1}", response.Code, response.Body.Trim()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/Entities/ContactGroup.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models.Entities 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using DreamFactory.AddressBook.Properties; 6 | using Newtonsoft.Json; 7 | 8 | public class ContactGroup 9 | { 10 | [JsonProperty(PropertyName = "id")] 11 | public int? Id { get; set; } 12 | 13 | [JsonProperty(PropertyName = "name")] 14 | [Display(Name = "Name")] 15 | [Required(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessage_Required", ErrorMessage = null)] 16 | [MaxLength(128, ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessage_MaxLength", ErrorMessage = null)] 17 | public string Name { get; set; } 18 | 19 | [JsonProperty(PropertyName = "contact_by_contact_group_relationship")] 20 | public List Contacts { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Config/ConfigRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Config 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// ConfigRequest. 8 | /// 9 | public class ConfigRequest 10 | { 11 | /// 12 | /// Comma-delimited list of fields the user is allowed to edit. 13 | /// 14 | [JsonProperty(PropertyName = "editable_profile_fields")] 15 | public string EditableProfileFields { get; set; } 16 | 17 | /// 18 | /// An array of HTTP verbs that must be tunneled on this server. 19 | /// 20 | [JsonProperty(PropertyName = "restricted_verbs")] 21 | public List RestrictedVerbs { get; set; } 22 | 23 | /// 24 | /// The date/time format used for timestamps. 25 | /// 26 | [JsonProperty(PropertyName = "timestamp_format")] 27 | public string TimestampFormat { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Config/ConfigResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Config 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// ConfigResponse. 8 | /// 9 | public class ConfigResponse 10 | { 11 | /// 12 | /// Comma-delimited list of fields the user is allowed to edit. 13 | /// 14 | [JsonProperty(PropertyName = "editable_profile_fields")] 15 | public string EditableProfileFields { get; set; } 16 | 17 | /// 18 | /// An array of HTTP verbs that must be tunneled on this server. 19 | /// 20 | [JsonProperty(PropertyName = "restricted_verbs")] 21 | public List RestrictedVerbs { get; set; } 22 | 23 | /// 24 | /// The date/time format used for timestamps. 25 | /// 26 | [JsonProperty(PropertyName = "timestamp_format")] 27 | public string TimestampFormat { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Role/RoleRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Role 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// RoleResponse. 7 | /// 8 | public class RoleRequest : IRecord 9 | { 10 | /// 11 | /// Identifier of this role. 12 | /// 13 | [JsonProperty(PropertyName = "id")] 14 | public int? Id { get; set; } 15 | 16 | /// 17 | /// Displayable name of this role. 18 | /// 19 | [JsonProperty(PropertyName = "name")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Description of this role. 24 | /// 25 | [JsonProperty(PropertyName = "description")] 26 | public string Description { get; set; } 27 | 28 | /// 29 | /// Is this role active for use. 30 | /// 31 | [JsonProperty(PropertyName = "is_active")] 32 | public bool? IsActive { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DreamFactory/Model/File/ListingFlags.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using global::System; 4 | 5 | /// 6 | /// Files listing modes. Combine values with binary OR. 7 | /// 8 | [Flags] 9 | public enum ListingFlags 10 | { 11 | /// 12 | /// Include files in the returned listing. 13 | /// 14 | IncludeFiles = 1, 15 | 16 | /// 17 | /// Include folders in the returned listing. 18 | /// 19 | IncludeFolders = 2, 20 | 21 | /// 22 | /// List the contents of all sub-folders as well. 23 | /// 24 | IncludeSubFolders = 4, 25 | 26 | /// 27 | /// Populate any available properties. 28 | /// 29 | IncludeProperties = 8, 30 | 31 | /// 32 | /// Enable all options. 33 | /// 34 | IncludeEverything = IncludeFiles | IncludeFolders | IncludeSubFolders | IncludeProperties 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/TableInfo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// A table information. 8 | /// 9 | public class TableInfo 10 | { 11 | /// 12 | /// Identifier/Name for the table. 13 | /// 14 | [JsonProperty(PropertyName = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Displayable singular name for the table. 19 | /// 20 | [JsonProperty(PropertyName = "label")] 21 | public string Label { get; set; } 22 | 23 | /// 24 | /// Displayable plural name for the table. 25 | /// 26 | [JsonProperty(PropertyName = "plural")] 27 | public string Plural { get; set; } 28 | 29 | /// 30 | /// List of allowed HTTP verbs. 31 | /// 32 | [JsonProperty(PropertyName = "access")] 33 | public List Access { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/EmailDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Api; 6 | using DreamFactory.Model.Builder; 7 | using DreamFactory.Model.Email; 8 | using DreamFactory.Rest; 9 | 10 | public class EmailDemo : IRunnable 11 | { 12 | public async Task RunAsync(IRestContext context) 13 | { 14 | // Send an email 15 | Console.WriteLine("Sending email..."); 16 | 17 | // Using the builder is good for simple emails 18 | EmailRequest request = new EmailRequestBuilder().AddTo("inbox@mail.com") 19 | .WithSubject("Hello") 20 | .WithBody("Hello, world!") 21 | .Build(); 22 | 23 | IEmailApi emailApi = context.Factory.CreateEmailApi("email"); 24 | int count = await emailApi.SendEmailAsync(request); 25 | 26 | Console.WriteLine("{0} email(s) sent.", count); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/ManageViewModels.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class IndexViewModel 6 | { 7 | public bool HasPassword { get; set; } 8 | public string PhoneNumber { get; set; } 9 | public bool BrowserRemembered { get; set; } 10 | } 11 | 12 | public class ChangePasswordViewModel 13 | { 14 | [Required] 15 | [DataType(DataType.Password)] 16 | [Display(Name = "Current password")] 17 | public string OldPassword { get; set; } 18 | 19 | [Required] 20 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 21 | [DataType(DataType.Password)] 22 | [Display(Name = "New password")] 23 | public string NewPassword { get; set; } 24 | 25 | [DataType(DataType.Password)] 26 | [Display(Name = "Confirm new password")] 27 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 28 | public string ConfirmPassword { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /DreamFactory/Model/Database/TypeMap.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using global::System; 4 | using global::System.Collections.Generic; 5 | 6 | internal static class TypeMap 7 | { 8 | private static readonly Dictionary Types = new Dictionary 9 | { 10 | { typeof (string), "string" }, 11 | { typeof (int), "integer" }, 12 | { typeof (long), "integer" }, 13 | { typeof (bool), "boolean" }, 14 | { typeof (byte[]), "binary" }, 15 | { typeof (float), "float" }, 16 | { typeof (double), "double" }, 17 | { typeof (decimal), "decimal" }, 18 | { typeof (DateTime), "datetime" }, 19 | }; 20 | 21 | public static string GetTypeName(Type fieldType) 22 | { 23 | string typeName; 24 | if (!Types.TryGetValue(fieldType, out typeName)) 25 | { 26 | throw new NotSupportedException("Type is not supported by database interface: " + fieldType.Name); 27 | } 28 | 29 | return typeName; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DreamFactory/Http/IHttpHeaders.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents immutable collection of HTTP headers. 7 | /// 8 | public interface IHttpHeaders 9 | { 10 | /// 11 | /// Returns new collection with a new header included. 12 | /// 13 | /// Header's name. 14 | /// Header's value. 15 | /// A new collection with a new header included. 16 | HttpHeaders Include(string key, object value); 17 | 18 | /// 19 | /// Returns new collection with a header excluded. 20 | /// 21 | /// Header's name. 22 | /// A new collection with a header excluded. 23 | HttpHeaders Exclude(string key); 24 | 25 | /// 26 | /// Returns a copy of the headers collection. 27 | /// 28 | /// A copy of the headers collection. 29 | Dictionary Build(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DreamFactory/Model/File/FolderRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// FolderRequest. 8 | /// 9 | public class FolderRequest 10 | { 11 | /// 12 | /// Gets Identifier/Name for the folder, localized to requested resource. 13 | /// 14 | [JsonProperty(PropertyName = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Full path of the folder, from the service including container. 19 | /// 20 | [JsonProperty(PropertyName = "path")] 21 | public string Path { get; set; } 22 | 23 | /// 24 | /// An array of sub-folders to create. 25 | /// 26 | [JsonProperty(PropertyName = "folder")] 27 | public List Folder { get; set; } 28 | 29 | /// 30 | /// An array of files to create. 31 | /// 32 | [JsonProperty(PropertyName = "file")] 33 | public List File { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Start/DependencyConfig.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook 2 | { 3 | using System.Web.Mvc; 4 | using global::DreamFactory.Api; 5 | using global::DreamFactory.Rest; 6 | using SimpleInjector; 7 | using SimpleInjector.Integration.Web.Mvc; 8 | 9 | public class DependencyConfig 10 | { 11 | public static void Initialize() 12 | { 13 | Container container = new Container(); 14 | 15 | IRestContext context = DreamFactoryContext.Create(); 16 | 17 | container.Register(() => context.Factory.CreateDatabaseApi(DreamFactoryContext.DbServiceName), Lifestyle.Transient); 18 | container.Register(() => context.Factory.CreateSystemAdminApi(), Lifestyle.Transient); 19 | container.Register(() => context.Factory.CreateUserApi(), Lifestyle.Transient); 20 | container.Register(() => context.Factory.CreateFilesApi(DreamFactoryContext.FileServiceName), Lifestyle.Transient); 21 | 22 | container.RegisterMvcControllers(); 23 | container.Verify(); 24 | 25 | DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "name": "applications", 5 | "path": "applications", 6 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 7 | "access": [ 8 | "GET", 9 | "POST", 10 | "PUT", 11 | "PATCH", 12 | "MERGE", 13 | "DELETE" 14 | ] 15 | }, 16 | { 17 | "name": "newbie", 18 | "path": "newbie", 19 | "last_modified": "Fri, 17 Apr 2015 16:15:54 GMT", 20 | "access": [ 21 | "GET", 22 | "POST", 23 | "PUT", 24 | "PATCH", 25 | "MERGE", 26 | "DELETE" 27 | ] 28 | }, 29 | { 30 | "name": "plugins", 31 | "path": "plugins", 32 | "last_modified": "Fri, 27 Mar 2015 12:09:21 GMT", 33 | "access": [ 34 | "GET", 35 | "POST", 36 | "PUT", 37 | "PATCH", 38 | "MERGE", 39 | "DELETE" 40 | ] 41 | }, 42 | { 43 | "name": "test", 44 | "path": "test", 45 | "last_modified": "Fri, 17 Apr 2015 16:15:10 GMT", 46 | "access": [ 47 | "GET", 48 | "POST", 49 | "PUT", 50 | "PATCH", 51 | "MERGE", 52 | "DELETE" 53 | ] 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Environment/PlatformSection.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Environment 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// PlatformSection. 7 | /// 8 | public class PlatformSection 9 | { 10 | /// 11 | /// is_hosted. 12 | /// 13 | [JsonProperty(PropertyName = "is_hosted")] 14 | public bool? IsHosted { get; set; } 15 | 16 | /// 17 | /// dsp_version_current. 18 | /// 19 | [JsonProperty(PropertyName = "version_current")] 20 | public string VersionCurrent { get; set; } 21 | 22 | /// 23 | /// dsp_version_latest. 24 | /// 25 | [JsonProperty(PropertyName = "version_latest")] 26 | public string VersionLatest { get; set; } 27 | 28 | /// 29 | /// upgrade_available. 30 | /// 31 | [JsonProperty(PropertyName = "upgrade_available")] 32 | public bool? UpgradeAvailable { get; set; } 33 | 34 | /// 35 | /// Host name. 36 | /// 37 | [JsonProperty(PropertyName = "host")] 38 | public string Host { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Lookup/LookupRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Lookup 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// LookupRequest. 7 | /// 8 | public class LookupRequest : IRecord 9 | { 10 | /// 11 | /// Identifier of this lookup. 12 | /// 13 | [JsonProperty(PropertyName = "id")] 14 | public int? Id { get; set; } 15 | 16 | /// 17 | /// Name for this lookup. 18 | /// 19 | [JsonProperty(PropertyName = "name")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Value of this lookup. 24 | /// 25 | [JsonProperty(PropertyName = "value")] 26 | public string Value { get; set; } 27 | 28 | /// 29 | /// Indicator whether this lookup is private. 30 | /// 31 | [JsonProperty(PropertyName = "private")] 32 | public bool? Private { get; set; } 33 | 34 | /// 35 | /// Description for this lookup. 36 | /// 37 | [JsonProperty(PropertyName = "description")] 38 | public string Description { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/user/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 2, 5 | "name": "demo", 6 | "first_name": "demo", 7 | "last_name": "demo", 8 | "last_login_date": "2015-08-26 22:06:54", 9 | "email": "demo@factory.com", 10 | "is_active": true, 11 | "phone": null, 12 | "security_question": null, 13 | "confirm_code": "y", 14 | "default_app_id": null, 15 | "adldap": null, 16 | "oauth_provider": null, 17 | "created_date": "2015-08-24 22:32:58", 18 | "last_modified_date": "2015-08-26 22:06:54", 19 | "created_by_id": 1, 20 | "last_modified_by_id": 1 21 | }, 22 | { 23 | "id": 3, 24 | "name": "address", 25 | "first_name": "address", 26 | "last_name": "address", 27 | "last_login_date": null, 28 | "email": "address@factory", 29 | "is_active": true, 30 | "phone": null, 31 | "security_question": null, 32 | "confirm_code": null, 33 | "default_app_id": null, 34 | "adldap": null, 35 | "oauth_provider": null, 36 | "created_date": "2015-08-24 22:33:50", 37 | "last_modified_date": "2015-08-24 22:34:00", 38 | "created_by_id": 1, 39 | "last_modified_by_id": 1 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /DreamFactoryNet.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DreamFactoryNet 5 | 2.0.4 6 | DreamFactory 7 | DreamFactory.com 8 | https://raw.githubusercontent.com/dreamfactorysoftware/.net-sdk/master/favicon_32x32.png 9 | https://github.com/dreamfactorysoftware/dsp-core/blob/master/LICENSE.txt 10 | https://github.com/dreamfactorysoftware/.net-sdk 11 | false 12 | .NET SDK for the DreamFactory REST API 13 | This is the new .NET SDK for the DreamFactory REST API targeting version DreamFactory 2.0 and above. For support of older DF instances use nuget package version 1.0.2. 14 | Please visit dreamfactory.com 15 | Copyright (c) DreamFactory 2015 16 | DreamFactory REST .NET API 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/EmailApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model.Email; 7 | using DreamFactory.Serialization; 8 | 9 | internal class EmailApi : BaseApi, IEmailApi 10 | { 11 | public EmailApi( 12 | IHttpAddress baseAddress, 13 | IHttpFacade httpFacade, 14 | IContentSerializer contentSerializer, 15 | HttpHeaders baseHeaders, 16 | string serviceName) 17 | : base(baseAddress, httpFacade, contentSerializer, baseHeaders, serviceName) 18 | { 19 | } 20 | 21 | public async Task SendEmailAsync(EmailRequest emailRequest) 22 | { 23 | if (emailRequest == null) 24 | { 25 | throw new ArgumentNullException("emailRequest"); 26 | } 27 | 28 | EmailResponse response = await base.RequestWithPayloadAsync( 29 | method: HttpMethod.Post, 30 | resourceParts: null, 31 | query: null, 32 | payload: emailRequest 33 | ); 34 | 35 | return response.Count ?? 0; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /DreamFactory/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DreamFactoryNet")] 9 | [assembly: AssemblyDescription(".NET Library for the DreamFactory REST API")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("DreamFactory")] 12 | [assembly: AssemblyProduct("DreamFactoryNet")] 13 | [assembly: AssemblyCopyright("Copyright © DreamFactory 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: NeutralResourcesLanguage("en")] 17 | 18 | // Version information for an assembly consists of the following four values: 19 | // 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // You can specify all the values or you can default the Build and Revision Numbers 26 | // by using the '*' as shown below: 27 | // [assembly: AssemblyVersion("1.0.*")] 28 | [assembly: AssemblyVersion("2.0.4.*")] 29 | [assembly: AssemblyFileVersion("1.0.0.0")] 30 | [assembly: InternalsVisibleTo("DreamFactory.Tests")] 31 | -------------------------------------------------------------------------------- /DreamFactory/Model/Builder/IEmailRequestBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Builder 2 | { 3 | using DreamFactory.Model.Email; 4 | 5 | /// 6 | /// Represents builder. 7 | /// 8 | public interface IEmailRequestBuilder 9 | { 10 | /// 11 | /// Adds To email address. 12 | /// 13 | /// Email address. 14 | /// Interface chaining. 15 | IEmailRequestBuilder AddTo(string email); 16 | 17 | /// 18 | /// Sets email subject. 19 | /// 20 | /// Subject. 21 | /// Interface chaining. 22 | IEmailRequestBuilder WithSubject(string subject); 23 | 24 | /// 25 | /// Sets email body text. 26 | /// 27 | /// Body text. 28 | /// Interface chaining. 29 | IEmailRequestBuilder WithBody(string text); 30 | 31 | /// 32 | /// Builds resulting instance. 33 | /// 34 | /// instance. 35 | EmailRequest Build(); 36 | } 37 | } -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/LoginDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Api; 6 | using DreamFactory.Model.User; 7 | using DreamFactory.Rest; 8 | 9 | public class LoginDemo : IRunnable 10 | { 11 | public async Task RunAsync(IRestContext context) 12 | { 13 | ISystemApi systemApi = context.Factory.CreateSystemApi(); 14 | 15 | try 16 | { 17 | Session session = await systemApi.LoginAdminAsync(Program.Email, Program.Password); 18 | Console.WriteLine("Logged in as {0}", session.Name); 19 | } 20 | catch (Exception ex) 21 | { 22 | Console.WriteLine(ex.Message); 23 | Console.ForegroundColor = ConsoleColor.Red; 24 | Console.WriteLine("Unfortunately, something went wrong."); 25 | Console.WriteLine("Please check the following:"); 26 | Console.WriteLine("\t- your DSP is listening: {0}", Program.BaseAddress); 27 | Console.WriteLine("\t- you have created user '{0}' with password '{1}'", Program.Email, Program.Password); 28 | Console.WriteLine(); 29 | Console.ResetColor(); 30 | 31 | throw; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

Address book demo

7 |

DreamFactory address book demo is a ASP.NET MVC application utilizing DreamFactory API for persistance, security and scalability.

8 |

Register now »

9 | 10 |
11 | 12 |
13 |
14 |

What is DreamFactory?

15 |

16 | DreamFactory is a free, open source REST API backend for mobile, web, and IoT applications. It provides RESTful web services for any data source so you can start front-end development with robust REST APIs on day one. 17 |

18 |

Learn more »

19 |
20 |
21 |

Why DreamFactory?

22 |

DreamFactory provides pre-built connectors to SQL, NoSQL, file storage systems, and web services. With a few clicks, you instantly get a comprehensive palette of secure, reusable, customizable REST APIs and live API documentation.

23 |

Try now »

24 |
25 |
-------------------------------------------------------------------------------- /DreamFactory.AddressBook/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /DreamFactory/Model/User/PasswordRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// PasswordRequest. 7 | /// 8 | public class PasswordRequest 9 | { 10 | /// 11 | /// Old password to validate change during a session. 12 | /// 13 | [JsonProperty(PropertyName = "old_password")] 14 | public string OldPassword { get; set; } 15 | 16 | /// 17 | /// New password to be set. 18 | /// 19 | [JsonProperty(PropertyName = "new_password")] 20 | public string NewPassword { get; set; } 21 | 22 | /// 23 | /// User's email to be used with code to validate email confirmation. 24 | /// 25 | [JsonProperty(PropertyName = "email")] 26 | public string Email { get; set; } 27 | 28 | /// 29 | /// Code required with new_password when using email confirmation. 30 | /// 31 | [JsonProperty(PropertyName = "code")] 32 | public string Code { get; set; } 33 | 34 | /// 35 | /// Code required with new_password when using email confirmation. 36 | /// 37 | [JsonProperty(PropertyName = "security_answer")] 38 | public string SecurityAnswer { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DreamFactory/Model/File/FileResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using global::System; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// FileResponse. 8 | /// 9 | public class FileResponse 10 | { 11 | /// 12 | /// Gets Identifier/Name for the file, localized to requested resource. 13 | /// 14 | [JsonProperty(PropertyName = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Full path of the file, from the service including container. 19 | /// 20 | [JsonProperty(PropertyName = "path")] 21 | public string Path { get; set; } 22 | 23 | /// 24 | /// The media type of the content of the file. 25 | /// 26 | [JsonProperty(PropertyName = "content_type")] 27 | public string ContentType { get; set; } 28 | 29 | /// 30 | /// Size of the file in bytes. 31 | /// 32 | [JsonProperty(PropertyName = "content_length")] 33 | public string ContentLength { get; set; } 34 | 35 | /// 36 | /// A GMT date timestamp of when the file was last modified. 37 | /// 38 | [JsonProperty(PropertyName = "last_modified")] 39 | public DateTime? LastModified { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/DiscoveryDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using DreamFactory.Model; 7 | using DreamFactory.Rest; 8 | 9 | public class DiscoveryDemo : IRunnable 10 | { 11 | public async Task RunAsync(IRestContext context) 12 | { 13 | // List available services 14 | IEnumerable services = context.GetServicesAsync().Result; 15 | Console.WriteLine("Available services:"); 16 | foreach (string service in services) 17 | { 18 | Console.WriteLine("\t/{0}", service); 19 | } 20 | 21 | // List resources 22 | IEnumerable resources = await context.GetResourcesAsync("user"); 23 | Console.WriteLine(); 24 | Console.WriteLine("/user resources:"); 25 | foreach (Resource resource in resources) 26 | { 27 | Console.WriteLine("\t/{0}", resource.Name); 28 | } 29 | 30 | resources = await context.GetResourcesAsync("files"); 31 | Console.WriteLine(); 32 | Console.WriteLine("/files resources:"); 33 | foreach (Resource resource in resources) 34 | { 35 | Console.WriteLine("\t/{0}", resource.Name); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DreamFactory/Serialization/IContentSerializer.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Serialization 2 | { 3 | /// 4 | /// Represents content serializer. 5 | /// 6 | public interface IContentSerializer 7 | { 8 | /// 9 | /// Gets content type string, e.g. application/json. 10 | /// 11 | string ContentType { get; } 12 | 13 | /// 14 | /// Serializes given object instance to string. 15 | /// 16 | /// Object instance. 17 | /// 18 | string Serialize(TObject instance) where TObject : class; 19 | 20 | /// 21 | /// Deserializes object from content string. 22 | /// 23 | /// Content string. 24 | /// Created object instance. 25 | TObject Deserialize(string content) where TObject : class; 26 | 27 | /// 28 | /// Deserializes anonymous object from content string. 29 | /// 30 | /// Content string. 31 | /// Anonymous instance to derive its type. 32 | /// Created object instance. 33 | TObject Deserialize(string content, TObject typeInstance) where TObject : class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DreamFactory/Model/File/FolderResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using global::System; 4 | using global::System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | /// 8 | /// FolderResponse. 9 | /// 10 | public class FolderResponse 11 | { 12 | /// 13 | /// Gets Identifier/Name for the folder, localized to requested resource. 14 | /// 15 | [JsonProperty(PropertyName = "name")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// Full path of the folder, from the service including container. 20 | /// 21 | [JsonProperty(PropertyName = "path")] 22 | public string Path { get; set; } 23 | 24 | /// 25 | /// A GMT date timestamp of when the folder was last modified. 26 | /// 27 | [JsonProperty(PropertyName = "last_modified")] 28 | public DateTime? LastModified { get; set; } 29 | 30 | /// 31 | /// An array of contained sub-folders. 32 | /// 33 | [JsonProperty(PropertyName = "folder")] 34 | public List Folder { get; set; } 35 | 36 | /// 37 | /// An array of contained files. 38 | /// 39 | [JsonProperty(PropertyName = "file")] 40 | public List File { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DreamFactory/Model/User/Register.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Register (new user). 7 | /// 8 | public class Register 9 | { 10 | /// 11 | /// Email address of the new user. 12 | /// 13 | [JsonProperty(PropertyName = "email")] 14 | public string Email { get; set; } 15 | 16 | /// 17 | /// First name of the new user. 18 | /// 19 | [JsonProperty(PropertyName = "first_name")] 20 | public string FirstName { get; set; } 21 | 22 | /// 23 | /// Last name of the new user. 24 | /// 25 | [JsonProperty(PropertyName = "last_name")] 26 | public string LastName { get; set; } 27 | 28 | /// 29 | /// Full display name of the new user. 30 | /// 31 | [JsonProperty(PropertyName = "name")] 32 | public string Name { get; set; } 33 | 34 | /// 35 | /// Password for the new user. 36 | /// 37 | [JsonProperty(PropertyName = "new_password")] 38 | public string NewPassword { get; set; } 39 | 40 | /// 41 | /// Code required with new_password when using email confirmation. 42 | /// 43 | [JsonProperty(PropertyName = "code")] 44 | public string Code { get; set; } 45 | } 46 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Service/ServiceRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Service 2 | { 3 | using global::System; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// ServiceResponse. 8 | /// 9 | public class ServiceRequest : IRecord 10 | { 11 | /// 12 | /// Identifier of this service. 13 | /// 14 | [JsonProperty(PropertyName = "id")] 15 | public int? Id { get; set; } 16 | 17 | /// 18 | /// Displayable name of this service. 19 | /// 20 | [JsonProperty(PropertyName = "name")] 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// Label of this service. 25 | /// 26 | [JsonProperty(PropertyName = "label")] 27 | public string Label { get; set; } 28 | 29 | /// 30 | /// Description of this service. 31 | /// 32 | [JsonProperty(PropertyName = "description")] 33 | public string Description { get; set; } 34 | 35 | /// 36 | /// True if this service is active for use. 37 | /// 38 | [JsonProperty(PropertyName = "is_active")] 39 | public bool? IsActive { get; set; } 40 | 41 | /// 42 | /// One of the supported service types. 43 | /// 44 | [JsonProperty(PropertyName = "type")] 45 | public string Type { get; set; } 46 | } 47 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace DreamFactory.AddressBok 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/bootstrap-table/bootstrap-table.js", 25 | "~/Scripts/respond.js")); 26 | 27 | bundles.Add(new StyleBundle("~/Content/css").Include( 28 | "~/Content/bootstrap.css", 29 | "~/Content/bootstrap-table.css", 30 | "~/Content/site.css")); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Event/EventScriptRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Event 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// EventScriptRequest. 7 | /// 8 | public class EventScriptRequest 9 | { 10 | /// 11 | /// Name of this event script 12 | /// 13 | [JsonProperty(PropertyName = "name")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Type for this event script. 18 | /// 19 | [JsonProperty(PropertyName = "type")] 20 | public string Type { get; set; } 21 | 22 | /// 23 | /// Indicator whether this event script is active. 24 | /// 25 | [JsonProperty(PropertyName = "is_active")] 26 | public bool? IsActive { get; set; } 27 | 28 | /// 29 | /// Indicator whether this event script affect process. 30 | /// 31 | [JsonProperty(PropertyName = "affects_process")] 32 | public bool? AffectsProcess { get; set; } 33 | 34 | /// 35 | /// Content of this event script. 36 | /// 37 | [JsonProperty(PropertyName = "content")] 38 | public string Content { get; set; } 39 | 40 | /// 41 | /// Config for this event script. 42 | /// 43 | [JsonProperty(PropertyName = "config")] 44 | public string Config { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DreamFactory.AddressBok")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DreamFactory.AddressBok")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9f6d7f0b-5812-4175-ad88-aaa41ca3a622")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /DreamFactory/Model/File/StorageResource.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.File 2 | { 3 | using global::System; 4 | using global::System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | /// 8 | /// A storage resource information. 9 | /// 10 | public class StorageResource 11 | { 12 | /// 13 | /// Identifier/Name for the resource. 14 | /// 15 | [JsonProperty(PropertyName = "name")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// Path for the resource. 20 | /// 21 | [JsonProperty(PropertyName = "path")] 22 | public string Path { get; set; } 23 | 24 | /// 25 | /// Date and time of last modification. 26 | /// 27 | [JsonProperty(PropertyName = "last_modified")] 28 | public DateTime? LastModified { get; set; } 29 | 30 | /// 31 | /// Resource content length. 32 | /// 33 | [JsonProperty(PropertyName = "content_length")] 34 | public int ContentLength { get; set; } 35 | 36 | /// 37 | /// Resource type. 38 | /// 39 | [JsonProperty(PropertyName = "type")] 40 | public string Type { get; set; } 41 | 42 | /// 43 | /// Resource content type. 44 | /// 45 | [JsonProperty(PropertyName = "content_type")] 46 | public string ContentType { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /DreamFactory.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("DreamFactory.Tests")] 8 | [assembly: AssemblyDescription("Unit Tests for DreamFactoryNet library")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("DreamFactory")] 11 | [assembly: AssemblyProduct("DreamFactory.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © DreamFactory 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("02841590-465a-4ad7-a974-b718fd4721e8")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/RelatedSchema.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Related schema. 7 | /// 8 | public class RelatedSchema 9 | { 10 | /// 11 | /// Name of the relationship. 12 | /// 13 | [JsonProperty(PropertyName = "name")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Relationship type - belongs_to, has_many, many_many. 18 | /// 19 | [JsonProperty(PropertyName = "type")] 20 | public string Type { get; set; } 21 | 22 | /// 23 | /// The table name that is referenced by the relationship. 24 | /// 25 | [JsonProperty(PropertyName = "ref_table")] 26 | public string RefTable { get; set; } 27 | 28 | /// 29 | /// The field name that is referenced by the relationship. 30 | /// 31 | [JsonProperty(PropertyName = "ref_field")] 32 | public string RefField { get; set; } 33 | 34 | /// 35 | /// The intermediate joining table used for many_many relationships. 36 | /// 37 | [JsonProperty(PropertyName = "join")] 38 | public string Join { get; set; } 39 | 40 | /// 41 | /// The current table field that is used in the relationship. 42 | /// 43 | [JsonProperty(PropertyName = "field")] 44 | public string Field { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Cors/CorsRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Cors 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// CORS request. 7 | /// 8 | public class CorsRequest : IRecord 9 | { 10 | /// 11 | /// Identifier of the record. 12 | /// 13 | [JsonProperty(PropertyName = "id")] 14 | public int? Id { get; set; } 15 | 16 | /// 17 | /// Path of the CORS. 18 | /// 19 | [JsonProperty(PropertyName = "path")] 20 | public string Path { get; set; } 21 | 22 | /// 23 | /// Origin of the CORS. 24 | /// 25 | [JsonProperty(PropertyName = "origin")] 26 | public string Origin { get; set; } 27 | 28 | /// 29 | /// Header of the CORS. 30 | /// 31 | [JsonProperty(PropertyName = "header")] 32 | public string Header { get; set; } 33 | 34 | /// 35 | /// HTTP methods allowed. 36 | /// 37 | [JsonProperty(PropertyName = "method")] 38 | public int? Method { get; set; } 39 | 40 | /// 41 | /// Max age. 42 | /// 43 | [JsonProperty(PropertyName = "max_age")] 44 | public int? MaxAge { get; set; } 45 | 46 | /// 47 | /// Indicates whether it is enabled. 48 | /// 49 | [JsonProperty(PropertyName = "enabled")] 50 | public bool Enabled { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 20 | 21 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("DreamFactory.Demo")] 8 | [assembly: AssemblyDescription("Demo Application for DreamFactoryNet library")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("DreamFactory")] 11 | [assembly: AssemblyProduct("DreamFactoryNet Demo Application")] 12 | [assembly: AssemblyCopyright("Copyright © DreamFactory 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("f68d8128-5fba-4a72-8b88-d8692bf4101d")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /DreamFactory/Model/Database/StoredProcParam.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Stored procedure parameter descriptor. 7 | /// 8 | public class StoredProcParam 9 | { 10 | /// 11 | /// Name of the parameter, required for OUT and INOUT types, must be the same as the stored procedure's parameter name. 12 | /// 13 | [JsonProperty(PropertyName = "name")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Parameter type of IN, OUT, or INOUT, defaults to IN. 18 | /// 19 | [JsonProperty(PropertyName = "param_type")] 20 | public string ParamType { get; set; } 21 | 22 | /// 23 | /// Value of the parameter, used for the IN and INOUT types, defaults to NULL. 24 | /// 25 | [JsonProperty(PropertyName = "value")] 26 | public string Value { get; set; } 27 | 28 | /// 29 | /// For INOUT and OUT parameters, the requested type for the returned value, i.e. integer, boolean, string, etc. Defaults to value type for INOUT and string for OUT. 30 | /// 31 | [JsonProperty(PropertyName = "type")] 32 | public string Type { get; set; } 33 | 34 | /// 35 | /// For INOUT and OUT parameters, the requested length for the returned value. May be required by some database drivers. 36 | /// 37 | [JsonProperty(PropertyName = "length")] 38 | public int? Length { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "system", 6 | "label": "System Management", 7 | "description": "Service for managing system resources.", 8 | "is_active": true, 9 | "type": "system", 10 | "mutable": false, 11 | "deletable": false, 12 | "created_date": "2015-08-24 22:27:07", 13 | "last_modified_date": "2015-08-24 22:27:07", 14 | "created_by_id": null, 15 | "last_modified_by_id": null, 16 | "config": [] 17 | }, 18 | { 19 | "id": 2, 20 | "name": "api_docs", 21 | "label": "Live API Docs", 22 | "description": "API documenting and testing service.", 23 | "is_active": true, 24 | "type": "swagger", 25 | "mutable": false, 26 | "deletable": false, 27 | "created_date": "2015-08-24 22:27:07", 28 | "last_modified_date": "2015-08-24 22:27:07", 29 | "created_by_id": null, 30 | "last_modified_by_id": null, 31 | "config": [] 32 | }, 33 | { 34 | "id": 3, 35 | "name": "files", 36 | "label": "Local File Storage", 37 | "description": "Service for accessing local file storage.", 38 | "is_active": true, 39 | "type": "local_file", 40 | "mutable": true, 41 | "deletable": true, 42 | "created_date": "2015-08-24 22:27:07", 43 | "last_modified_date": "2015-08-27 20:43:34", 44 | "created_by_id": null, 45 | "last_modified_by_id": 1, 46 | "config": { 47 | "service_id": 3, 48 | "public_path": null, 49 | "container": "local" 50 | } 51 | } 52 | ] 53 | } -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/system/service/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": [ 3 | { 4 | "id": 1, 5 | "name": "system", 6 | "label": "System Management", 7 | "description": "Service for managing system resources.", 8 | "is_active": true, 9 | "type": "system", 10 | "mutable": false, 11 | "deletable": false, 12 | "created_date": "2015-08-24 22:27:07", 13 | "last_modified_date": "2015-08-24 22:27:07", 14 | "created_by_id": null, 15 | "last_modified_by_id": null, 16 | "config": [] 17 | }, 18 | { 19 | "id": 2, 20 | "name": "api_docs", 21 | "label": "Live API Docs", 22 | "description": "API documenting and testing service.", 23 | "is_active": true, 24 | "type": "swagger", 25 | "mutable": false, 26 | "deletable": false, 27 | "created_date": "2015-08-24 22:27:07", 28 | "last_modified_date": "2015-08-24 22:27:07", 29 | "created_by_id": null, 30 | "last_modified_by_id": null, 31 | "config": [] 32 | }, 33 | { 34 | "id": 3, 35 | "name": "files", 36 | "label": "Local File Storage", 37 | "description": "Service for accessing local file storage.", 38 | "is_active": true, 39 | "type": "local_file", 40 | "mutable": true, 41 | "deletable": true, 42 | "created_date": "2015-08-24 22:27:07", 43 | "last_modified_date": "2015-08-27 20:43:34", 44 | "created_by_id": null, 45 | "last_modified_by_id": 1, 46 | "config": { 47 | "service_id": 3, 48 | "public_path": null, 49 | "container": "local" 50 | } 51 | } 52 | ] 53 | } -------------------------------------------------------------------------------- /DreamFactory/Http/IHttpAddress.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | using DreamFactory.Rest; 4 | 5 | /// 6 | /// Represents HTTP address builder. 7 | /// 8 | public interface IHttpAddress 9 | { 10 | /// 11 | /// Sets base address (protocol and host). 12 | /// 13 | /// Base address value. 14 | /// New instance of the builder. 15 | IHttpAddress WithBaseAddress(string value); 16 | 17 | /// 18 | /// Sets REST API version. 19 | /// 20 | /// REST API version. 21 | /// New instance of the builder. 22 | IHttpAddress WithVersion(RestApiVersion value); 23 | 24 | /// 25 | /// Add resources (e.g. "rest, user, session"). 26 | /// 27 | /// Resource names to add. 28 | /// New instance of the builder. 29 | IHttpAddress WithResource(params string[] values); 30 | 31 | /// 32 | /// Adds a query parameter. 33 | /// 34 | /// Query parameter name. 35 | /// Query parameter value. 36 | /// New instance of the builder. 37 | IHttpAddress WithParameter(string name, object value); 38 | 39 | /// 40 | /// Builds the final address. 41 | /// 42 | /// Final HTTP address. 43 | string Build(); 44 | } 45 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model DreamFactory.AddressBook.Models.ChangePasswordViewModel 2 | @{ 3 | ViewBag.Title = "Change Password"; 4 | } 5 | 6 |

@ViewBag.Title.

7 |

@ViewBag.StatusMessage

8 | 9 | 10 | @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 11 | { 12 | @Html.AntiForgeryToken() 13 |

Change Password Form

14 |
15 | @Html.ValidationSummary("", new { @class = "text-danger" }) 16 |
17 | @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) 18 |
19 | @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) 20 |
21 |
22 |
23 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 24 |
25 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 26 |
27 |
28 |
29 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 30 |
31 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 32 |
33 |
34 |
35 |
36 | 37 |
38 |
39 | } 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Environment/EnvironmentResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Environment 2 | { 3 | using DreamFactory.Model.System.App; 4 | using global::System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | /// 8 | /// EnvironmentResponse. 9 | /// 10 | public class EnvironmentResponse 11 | { 12 | 13 | /// 14 | /// Platform info. 15 | /// 16 | [JsonProperty(PropertyName = "platform")] 17 | public PlatformSection Platform { get; set; } 18 | 19 | /// 20 | /// Authentication metadata. 21 | /// 22 | [JsonProperty(PropertyName = "authentication")] 23 | public object Authentication { get; set; } 24 | 25 | /// 26 | /// Server metadata. 27 | /// 28 | [JsonProperty(PropertyName = "server")] 29 | public object Server { get; set; } 30 | 31 | /// 32 | /// Config metadata. 33 | /// 34 | [JsonProperty(PropertyName = "config")] 35 | public object Config { get; set; } 36 | 37 | /// 38 | /// Related app groups. 39 | /// 40 | [JsonProperty(PropertyName = RelatedResources.Environment.AppsInAppGroups)] 41 | public List AppsInAppGroups { get; set; } 42 | 43 | /// 44 | /// Unrelated app groups. 45 | /// 46 | [JsonProperty(PropertyName = RelatedResources.Environment.AppsNotInAppGroups)] 47 | public List AppsNotInAppGroups { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Models/AccountViewModels.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class LoginViewModel 6 | { 7 | [Required] 8 | [Display(Name = "Email")] 9 | [EmailAddress] 10 | public string Email { get; set; } 11 | 12 | [Required] 13 | [DataType(DataType.Password)] 14 | [Display(Name = "Password")] 15 | public string Password { get; set; } 16 | 17 | [Display(Name = "Remember me?")] 18 | public bool RememberMe { get; set; } 19 | } 20 | 21 | public class RegisterViewModel 22 | { 23 | [Required] 24 | [EmailAddress] 25 | [Display(Name = "Email")] 26 | public string Email { get; set; } 27 | 28 | [Required] 29 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 30 | [DataType(DataType.Password)] 31 | [Display(Name = "Password")] 32 | public string Password { get; set; } 33 | 34 | [DataType(DataType.Password)] 35 | [Display(Name = "Confirm password")] 36 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 37 | public string ConfirmPassword { get; set; } 38 | 39 | [Required] 40 | [Display(Name = "First name")] 41 | public string FirstName { get; set; } 42 | 43 | [Required] 44 | [Display(Name = "Last name")] 45 | public string LastName { get; set; } 46 | 47 | [Required] 48 | [Display(Name = "Display name")] 49 | public string Name { get; set; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /DreamFactory/Model/User/ProfileResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// ProfileResponse. 7 | /// 8 | public class ProfileResponse 9 | { 10 | /// 11 | /// Email address of the current user. 12 | /// 13 | [JsonProperty(PropertyName = "email")] 14 | public string Email { get; set; } 15 | 16 | /// 17 | /// First name of the current user. 18 | /// 19 | [JsonProperty(PropertyName = "first_name")] 20 | public string FirstName { get; set; } 21 | 22 | /// 23 | /// Last name of the current user. 24 | /// 25 | [JsonProperty(PropertyName = "last_name")] 26 | public string LastName { get; set; } 27 | 28 | /// 29 | /// Full display name of the current user. 30 | /// 31 | [JsonProperty(PropertyName = "name")] 32 | public string Name { get; set; } 33 | 34 | /// 35 | /// Phone number. 36 | /// 37 | [JsonProperty(PropertyName = "phone")] 38 | public string Phone { get; set; } 39 | 40 | /// 41 | /// Question to be answered to initiate password reset. 42 | /// 43 | [JsonProperty(PropertyName = "security_question")] 44 | public string SecurityQuestion { get; set; } 45 | 46 | /// 47 | /// Id of the application to be launched at login. 48 | /// 49 | [JsonProperty(PropertyName = "default_app_id")] 50 | public int? DefaultAppId { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/App_Start/DreamFactoryContext.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.AddressBook 2 | { 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using System.Web; 7 | using global::DreamFactory.Rest; 8 | 9 | public static class DreamFactoryContext 10 | { 11 | public const RestApiVersion Version = RestApiVersion.V2; 12 | public const string AppName = ""; 13 | public const string AppApiKey = ""; 14 | public const string BaseAddress = "http://localhost:8080"; 15 | public const string DbServiceName = "db"; 16 | public const string FileServiceName = "files"; 17 | 18 | #region security 19 | 20 | public const string SessionIdClaimType = "http://dreamfactory.com/claims/sessionid"; 21 | 22 | public static string SessionId 23 | { 24 | get 25 | { 26 | if (HttpContext.Current.User == null || HttpContext.Current.User.Identity == null) 27 | { 28 | return string.Empty; 29 | } 30 | 31 | ClaimsIdentity identity = (ClaimsIdentity)HttpContext.Current.User.Identity; 32 | IEnumerable claims = identity.Claims; 33 | return claims.Where(x => x.Type == SessionIdClaimType).Select(x => x.Value).FirstOrDefault(); 34 | } 35 | } 36 | 37 | public struct Roles 38 | { 39 | public const string SysAdmin = "sys_admin"; 40 | } 41 | 42 | #endregion 43 | 44 | public static IRestContext Create() 45 | { 46 | return new RestContext(BaseAddress, AppName, AppApiKey, SessionId, Version); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /DreamFactory/Model/System/Setting/RelatedSetting.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Setting 2 | { 3 | using global::System; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// RelatedSetting. 8 | /// 9 | public class RelatedSetting 10 | { 11 | /// 12 | /// Id of this setting. 13 | /// 14 | [JsonProperty(PropertyName = "id")] 15 | public int? Id { get; set; } 16 | 17 | /// 18 | /// Name of this setting. 19 | /// 20 | [JsonProperty(PropertyName = "name")] 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// Value of this setting. 25 | /// 26 | [JsonProperty(PropertyName = "value")] 27 | public string Value { get; set; } 28 | 29 | /// 30 | /// Id of the user that created this setting. 31 | /// 32 | [JsonProperty(PropertyName = "created_by_id")] 33 | public int? CreatedById { get; set; } 34 | 35 | /// 36 | /// Id of the user that last modified this setting. 37 | /// 38 | [JsonProperty(PropertyName = "last_modified_by_id")] 39 | public int? LastModifiedById { get; set; } 40 | 41 | /// 42 | /// Date this setting was created. 43 | /// 44 | [JsonProperty(PropertyName = "created_date")] 45 | public DateTime? CreatedDate { get; set; } 46 | 47 | /// 48 | /// Date this setting was last modified. 49 | /// 50 | [JsonProperty(PropertyName = "last_modified_date")] 51 | public DateTime? LastModifiedDate { get; set; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/FilesDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using DreamFactory.Api; 8 | using DreamFactory.Model.File; 9 | using DreamFactory.Rest; 10 | 11 | public class FilesDemo : IRunnable 12 | { 13 | public async Task RunAsync(IRestContext context) 14 | { 15 | IFilesApi filesApi = context.Factory.CreateFilesApi("files"); 16 | 17 | // Display resources 18 | IEnumerable names = await filesApi.GetResourceNamesAsync(); 19 | Console.WriteLine("GetResourcesAsync():"); 20 | foreach (string name in names) 21 | { 22 | Console.WriteLine("\t{0}", name); 23 | } 24 | 25 | // Creating a folder 26 | await filesApi.CreateFolderAsync("test", true); 27 | Console.WriteLine("Folder 'test' created."); 28 | 29 | // Creating a file 30 | FileResponse response = await filesApi.CreateFileAsync("test/test.txt", "test", true); 31 | Console.WriteLine("Created file: {0}", response.Path); 32 | 33 | // Reading the file 34 | string content = await filesApi.GetTextFileAsync("test/test.txt"); 35 | Console.WriteLine("GetFile content: {0}", content); 36 | 37 | // Deleting the file 38 | response = await filesApi.DeleteFileAsync("test/test.txt"); 39 | Console.WriteLine("Deleted file: {0}", response.Path); 40 | 41 | // Deleting the folder 42 | await filesApi.DeleteFolderAsync("test", true); 43 | Console.WriteLine("Folder 'test' deleted."); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/ContactGroup/List.cshtml: -------------------------------------------------------------------------------- 1 | @using DreamFactory.AddressBook.Extensions 2 | @using DreamFactory.AddressBook.Models.Entities 3 | @model IEnumerable 4 | 5 | @{ 6 | ViewBag.Title = "Contact groups"; 7 | } 8 | 9 |

@ViewBag.Title

10 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach (ContactGroup group in Model) 25 | { 26 | 27 | 28 | 29 | 37 | 38 | } 39 | @if (!Model.Any()) 40 | { 41 | 42 | } 43 | 44 |
@Html.Label("Id")@Html.Label("Name")@Html.Label("Action")
@group.Id@group.Name 30 | 31 | Contacts 32 | 33 | 34 | Edit 35 | 36 |
No records found.
45 | 46 | @Html.Partial("Paging", "ContactGroup") 47 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Demo/UserDemo.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Demo 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Api; 6 | using DreamFactory.Model.User; 7 | using DreamFactory.Rest; 8 | 9 | public class UserDemo : IRunnable 10 | { 11 | public async Task RunAsync(IRestContext context) 12 | { 13 | // IUserApi provides all functions for user management 14 | IUserApi userApi = context.Factory.CreateUserApi(); 15 | 16 | // getSession() 17 | Session session = await userApi.GetSessionAsync(); 18 | Console.WriteLine("Session ID: [{0}...]", session.SessionId.Substring(0, 32)); 19 | 20 | // getProfile() 21 | ProfileResponse profile = await userApi.GetProfileAsync(); 22 | Console.WriteLine("Email from your profile: {0}", profile.Email); 23 | 24 | // register() 25 | string guid = Guid.NewGuid().ToString(); 26 | Register register = new Register 27 | { 28 | FirstName = guid.Substring(0, 6), 29 | LastName = guid.Substring(0, 6), 30 | Email = guid.Substring(0, 6) + "@factory.com", 31 | Name = guid.Substring(0, 6), 32 | NewPassword = guid.Substring(0, 6) 33 | }; 34 | bool ok = await userApi.RegisterAsync(register, true); 35 | 36 | if (ok) 37 | { 38 | Console.WriteLine("Successfully registered user: {0}", guid.Substring(0,8)); 39 | } 40 | else 41 | { 42 | Console.ForegroundColor = ConsoleColor.Red; 43 | Console.WriteLine("Unfortunately, something went wrong."); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/Script/RelatedScriptType.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.Script 2 | { 3 | using global::System; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// RelatedScriptType. 8 | /// 9 | public class RelatedScriptType 10 | { 11 | /// 12 | /// Name of this script type. 13 | /// 14 | [JsonProperty(PropertyName = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Class name of this script type. 19 | /// 20 | [JsonProperty(PropertyName = "class_name")] 21 | public string ClassName { get; set; } 22 | 23 | /// 24 | /// Label for this script type. 25 | /// 26 | [JsonProperty(PropertyName = "label")] 27 | public string Label { get; set; } 28 | 29 | /// 30 | /// Description for this script type. 31 | /// 32 | [JsonProperty(PropertyName = "description")] 33 | public string Description { get; set; } 34 | 35 | /// 36 | /// Indicator whether this script type is sandboxed. 37 | /// 38 | [JsonProperty(PropertyName = "sandboxed")] 39 | public bool? Sandboxed { get; set; } 40 | 41 | /// 42 | /// Date this script type was created. 43 | /// 44 | [JsonProperty(PropertyName = "created_date")] 45 | public DateTime? CreatedDate { get; set; } 46 | 47 | /// 48 | /// Date this script type was last modified. 49 | /// 50 | [JsonProperty(PropertyName = "last_modified_date")] 51 | public DateTime? LastModifiedDate { get; set; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Rest/IRestContext.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Rest 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Serialization; 8 | 9 | /// 10 | /// Represents DreamFactory REST API entry point. 11 | /// 12 | public interface IRestContext 13 | { 14 | /// 15 | /// Gets instance. 16 | /// 17 | IHttpFacade HttpFacade { get; } 18 | 19 | /// 20 | /// Gets instance. 21 | /// 22 | IContentSerializer ContentSerializer { get; } 23 | 24 | /// 25 | /// Gets base headers collection. 26 | /// 27 | IHttpHeaders BaseHeaders { get; } 28 | 29 | /// 30 | /// Gets instance. 31 | /// 32 | IServiceFactory Factory { get; } 33 | 34 | /// 35 | /// Sets application name header. 36 | /// 37 | /// New application name. 38 | void SetApplicationName(string applicationName); 39 | 40 | /// 41 | /// Gets services exposed from the current DSP. 42 | /// 43 | /// Sequence of service descriptors. 44 | Task> GetServicesAsync(); 45 | 46 | /// 47 | /// Gets resources available for the service. 48 | /// 49 | /// Sequence of resource descriptors. 50 | Task> GetResourcesAsync(string serviceName); 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Model/System/AppGroup/RelatedAppGroup.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.System.AppGroup 2 | { 3 | using global::System; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// RelatedAppGroup. 8 | /// 9 | public class RelatedAppGroup 10 | { 11 | /// 12 | /// Identifier of this application group. 13 | /// 14 | [JsonProperty(PropertyName = "id")] 15 | public int? Id { get; set; } 16 | 17 | /// 18 | /// Displayable name of this application group. 19 | /// 20 | [JsonProperty(PropertyName = "name")] 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// Description of this application group. 25 | /// 26 | [JsonProperty(PropertyName = "description")] 27 | public string Description { get; set; } 28 | 29 | /// 30 | /// Date this group was created. 31 | /// 32 | [JsonProperty(PropertyName = "created_date")] 33 | public DateTime? CreatedDate { get; set; } 34 | 35 | /// 36 | /// User Id of who created this group. 37 | /// 38 | [JsonProperty(PropertyName = "created_by_id")] 39 | public int? CreatedById { get; set; } 40 | 41 | /// 42 | /// Date this group was last modified. 43 | /// 44 | [JsonProperty(PropertyName = "last_modified_date")] 45 | public DateTime? LastModifiedDate { get; set; } 46 | 47 | /// 48 | /// User Id of who last modified this group. 49 | /// 50 | [JsonProperty(PropertyName = "last_modified_by_id")] 51 | public int? LastModifiedById { get; set; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory.Demo/Test/SystemEventTest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Demo.Test 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using DreamFactory.Api; 8 | using DreamFactory.Model.Database; 9 | using DreamFactory.Model.System.Event; 10 | using DreamFactory.Rest; 11 | 12 | public class SystemEventTest : IRunnable 13 | { 14 | public async Task RunAsync(IRestContext context) 15 | { 16 | ISystemEventApi eventApi = context.Factory.CreateSystemEventApi(); 17 | 18 | IEnumerable events = (await eventApi.GetEventsAsync()).ToList(); 19 | Console.WriteLine("GetEventsAsync(): Found {0} events", events.Count()); 20 | 21 | string eventName = events.First(); 22 | 23 | // create 24 | EventScriptRequest createRequest = CreateEventScript(); 25 | EventScriptResponse createResponse = await eventApi.CreateEventScriptAsync(eventName, new SqlQuery(), createRequest); 26 | Console.WriteLine("CreateEventScriptAsync(): Created script {0}", createResponse.Name); 27 | 28 | // delete 29 | EventScriptResponse deleteResponse = await eventApi.DeleteEventScriptAsync(eventName, new SqlQuery()); 30 | Console.WriteLine("DeleteEventScriptAsync(): Deleted script {0}", deleteResponse.Name); 31 | } 32 | 33 | private EventScriptRequest CreateEventScript() 34 | { 35 | return new EventScriptRequest 36 | { 37 | Name = "my_event_script", 38 | Type = "v8js", 39 | IsActive = true, 40 | AffectsProcess = true, 41 | Content = "text", 42 | Config = "text" 43 | }; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /DreamFactory/Model/Database/TableSchema.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Database 2 | { 3 | using global::System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Table schema. 8 | /// 9 | public class TableSchema 10 | { 11 | /// 12 | /// Identifier/Name for the table. 13 | /// 14 | [JsonProperty(PropertyName = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Displayable singular name for the table. 19 | /// 20 | [JsonProperty(PropertyName = "label")] 21 | public string Label { get; set; } 22 | 23 | /// 24 | /// Displayable plural name for the table. 25 | /// 26 | [JsonProperty(PropertyName = "plural")] 27 | public string Plural { get; set; } 28 | 29 | /// 30 | /// Field(s), if any, that represent the primary key of each record. 31 | /// 32 | [JsonProperty(PropertyName = "primary_key")] 33 | public string PrimaryKey { get; set; } 34 | 35 | /// 36 | /// Field(s), if any, that represent the name of each record. 37 | /// 38 | [JsonProperty(PropertyName = "name_field")] 39 | public string NameField { get; set; } 40 | 41 | /// 42 | /// An array of available fields in each record. 43 | /// 44 | [JsonProperty(PropertyName = "field")] 45 | public List Field { get; set; } 46 | 47 | /// 48 | /// An array of available relationships to other tables. 49 | /// 50 | [JsonProperty(PropertyName = "related")] 51 | public List Related { get; set; } 52 | } 53 | } -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewBag.Title - DF Address book demo 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 34 |
35 | @RenderBody() 36 |
37 |
38 |

© @DateTime.Now.Year - DreamFactory ASP.NET demo application

39 |
40 |
41 | 42 | @Scripts.Render("~/bundles/jquery") 43 | @Scripts.Render("~/bundles/bootstrap") 44 | @RenderSection("scripts", required: false) 45 | 46 | 47 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemAdminApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.User; 4 | using global::System.Threading.Tasks; 5 | 6 | /// 7 | /// Represents /system/admin API. 8 | /// 9 | public interface ISystemAdminApi 10 | { 11 | /// 12 | /// Login and create a new admin session. 13 | /// 14 | /// 15 | /// Successful login operation will set ApplicationName and SessionToken headers. 16 | /// This call works only with v2 of the api. 17 | /// 18 | /// Email. 19 | /// Password. 20 | /// Session duration. 21 | /// Session object instance. 22 | Task LoginAdminAsync(string email, string password, int duration = 0); 23 | 24 | /// 25 | /// Logout and destroy the current admin session. 26 | /// 27 | /// 28 | /// True if the operation was successful and false if it wasn't. 29 | /// 30 | Task LogoutAdminAsync(); 31 | 32 | /// 33 | /// Retrieve the current admin session information. 34 | /// 35 | /// Session object instance. 36 | Task GetAdminSessionAsync(); 37 | 38 | /// 39 | /// Change the admin's password. 40 | /// 41 | /// Old password. 42 | /// New password. 43 | /// True when API call was successful, false or error otherwise. 44 | Task ChangeAdminPasswordAsync(string oldPassword, string newPassword); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.App.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.App; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetAppsAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "app", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | 23 | public Task> CreateAppsAsync(SqlQuery query, params AppRequest[] apps) 24 | { 25 | return base.RequestWithPayloadAsync( 26 | method: HttpMethod.Post, 27 | resource: "app", 28 | query: query, 29 | payload: apps 30 | ); 31 | } 32 | 33 | public Task> UpdateAppsAsync(SqlQuery query, params AppRequest[] apps) 34 | { 35 | return base.RequestWithPayloadAsync( 36 | method: HttpMethod.Patch, 37 | resource: "app", 38 | query: query, 39 | payload: apps 40 | ); 41 | } 42 | 43 | public Task> DeleteAppsAsync(SqlQuery query, params int[] ids) 44 | { 45 | return base.RequestDeleteAsync( 46 | resource: "app", 47 | query: query, 48 | force: false, 49 | ids: ids 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.User.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.User; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetUsersAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "user", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | public Task> CreateUsersAsync(SqlQuery query, params UserRequest[] users) 23 | { 24 | return base.RequestWithPayloadAsync( 25 | method: HttpMethod.Post, 26 | resource: "user", 27 | query: query, 28 | payload: users 29 | ); 30 | } 31 | public Task> UpdateUsersAsync(SqlQuery query, params UserRequest[] users) 32 | { 33 | return base.RequestWithPayloadAsync( 34 | method: HttpMethod.Patch, 35 | resource: "user", 36 | query: query, 37 | payload: users 38 | ); 39 | } 40 | public Task> DeleteUsersAsync(SqlQuery query, params int[] ids) 41 | { 42 | return base.RequestDeleteAsync( 43 | resource: "user", 44 | query: query, 45 | force: false, 46 | ids: ids 47 | ); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemEventApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.Event; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/event API. 10 | /// 11 | public interface ISystemEventApi 12 | { 13 | 14 | /// 15 | /// Gets all system events. 16 | /// 17 | /// List of all event names. 18 | Task> GetEventsAsync(); 19 | 20 | /// 21 | /// Gets event script by name. 22 | /// 23 | /// Event script identifier. 24 | /// Query parameters. 25 | /// Event script with queried fields and relationships. 26 | Task GetEventScriptAsync(string eventName, SqlQuery query); 27 | 28 | /// 29 | /// Create event script. 30 | /// 31 | /// Event script identifier. 32 | /// Query parameters. 33 | /// Event script to create. 34 | /// Event script with queried fields and relationships. 35 | Task CreateEventScriptAsync(string eventName, SqlQuery query, EventScriptRequest eventScript); 36 | 37 | /// 38 | /// Delete event script. 39 | /// 40 | /// Event script identifier. 41 | /// Query parameters. 42 | /// Event script with queried fields and relationships. 43 | Task DeleteEventScriptAsync(string eventName, SqlQuery query); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemRoleApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.Role; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/role API. 10 | /// 11 | public interface ISystemRoleApi 12 | { 13 | /// 14 | /// Retrieve one or more roles. 15 | /// 16 | /// Query parameters. 17 | /// List of roles. 18 | Task> GetRolesAsync(SqlQuery query); 19 | 20 | /// 21 | /// Create one or more roles. 22 | /// 23 | /// Query parameters. 24 | /// Roles to create. 25 | /// List of created roles. 26 | Task> CreateRolesAsync(SqlQuery query, params RoleRequest[] roles); 27 | 28 | /// 29 | /// Update one or more roles. 30 | /// 31 | /// Query parameters. 32 | /// Roles to update. 33 | /// List of updated roles. 34 | Task> UpdateRolesAsync(SqlQuery query, params RoleRequest[] roles); 35 | 36 | /// 37 | /// Delete one or more roles. 38 | /// 39 | /// Query parameters. 40 | /// Role IDs to delete. 41 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 42 | Task> DeleteRolesAsync(SqlQuery query, params int[] ids); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemUserApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.User; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/user API. 10 | /// 11 | public interface ISystemUserApi 12 | { 13 | /// 14 | /// Retrieve one or more users. 15 | /// 16 | /// Query parameters. 17 | /// List of users. 18 | Task> GetUsersAsync(SqlQuery query); 19 | 20 | /// 21 | /// Create one or more users. 22 | /// 23 | /// Query parameters. 24 | /// Users to create. 25 | /// List of created users. 26 | Task> CreateUsersAsync(SqlQuery query, params UserRequest[] users); 27 | 28 | /// 29 | /// Update one or more users. 30 | /// 31 | /// Query parameters. 32 | /// Users to update. 33 | /// List of updated users. 34 | Task> UpdateUsersAsync(SqlQuery query, params UserRequest[] users); 35 | 36 | /// 37 | /// Delete one or more users. 38 | /// 39 | /// Query parameters. 40 | /// User IDs to delete. 41 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 42 | Task> DeleteUsersAsync(SqlQuery query, params int[] ids); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.Role.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.Role; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetRolesAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "role", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | 23 | public Task> CreateRolesAsync(SqlQuery query, params RoleRequest[] roles) 24 | { 25 | return base.RequestWithPayloadAsync( 26 | method: HttpMethod.Post, 27 | resource: "role", 28 | query: query, 29 | payload: roles 30 | ); 31 | } 32 | 33 | public Task> UpdateRolesAsync(SqlQuery query, params RoleRequest[] roles) 34 | { 35 | return base.RequestWithPayloadAsync( 36 | method: HttpMethod.Patch, 37 | resource: "role", 38 | query: query, 39 | payload: roles 40 | ); 41 | } 42 | 43 | public Task> DeleteRolesAsync(SqlQuery query, params int[] ids) 44 | { 45 | return base.RequestDeleteAsync( 46 | resource: "role", 47 | query: query, 48 | force: false, 49 | ids: ids 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Model/User/ProfileRequest.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.User 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// ProfileRequest 7 | /// 8 | public class ProfileRequest 9 | { 10 | /// 11 | /// Email address of the current user. 12 | /// 13 | [JsonProperty(PropertyName = "email")] 14 | public string Email { get; set; } 15 | 16 | /// 17 | /// First name of the current user. 18 | /// 19 | [JsonProperty(PropertyName = "first_name")] 20 | public string FirstName { get; set; } 21 | 22 | /// 23 | /// Last name of the current user. 24 | /// 25 | [JsonProperty(PropertyName = "last_name")] 26 | public string LastName { get; set; } 27 | 28 | /// 29 | /// Full display name of the current user. 30 | /// 31 | [JsonProperty(PropertyName = "display_name")] 32 | public string DisplayName { get; set; } 33 | 34 | /// 35 | /// Phone number. 36 | /// 37 | [JsonProperty(PropertyName = "phone")] 38 | public string Phone { get; set; } 39 | 40 | /// 41 | /// Question to be answered to initiate password reset. 42 | /// 43 | [JsonProperty(PropertyName = "security_question")] 44 | public string SecurityQuestion { get; set; } 45 | 46 | /// 47 | /// Id of the application to be launched at login. 48 | /// 49 | [JsonProperty(PropertyName = "default_app_id")] 50 | public int? DefaultAppId { get; set; } 51 | 52 | /// 53 | /// Answer to the security question. 54 | /// 55 | [JsonProperty(PropertyName = "security_answer")] 56 | public string SecurityAnswer { get; set; } 57 | } 58 | } -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.Cors.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.Cors; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetCorsAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "cors", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | 23 | 24 | public Task> CreateCorsAsync(SqlQuery query, params CorsRequest[] templates) 25 | { 26 | return base.RequestWithPayloadAsync( 27 | method: HttpMethod.Post, 28 | resource: "cors", 29 | query: query, 30 | payload: templates 31 | ); 32 | } 33 | 34 | public Task> UpdateCorsAsync(SqlQuery query, params CorsRequest[] templates) 35 | { 36 | return base.RequestWithPayloadAsync( 37 | method: HttpMethod.Patch, 38 | resource: "cors", 39 | query: query, 40 | payload: templates 41 | ); 42 | } 43 | 44 | public Task> DeleteCorsAsync(SqlQuery query, params int[] ids) 45 | { 46 | return base.RequestDeleteAsync( 47 | resource: "cors", 48 | query: query, 49 | force: false, 50 | ids: ids 51 | ); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /DreamFactory/Http/HttpResponse.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Http 2 | { 3 | using System; 4 | using System.IO; 5 | 6 | /// 7 | /// Represents generic HTTP response. 8 | /// 9 | public class HttpResponse : IHttpResponse 10 | { 11 | private string bodyString; 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// Originating request. 17 | /// HTTP status code. 18 | /// HTTP response raw body 19 | public HttpResponse(IHttpRequest request, int code, byte[] raw) 20 | { 21 | if (request == null) 22 | { 23 | throw new ArgumentNullException("request"); 24 | } 25 | 26 | if (raw == null) 27 | { 28 | throw new ArgumentNullException("raw"); 29 | } 30 | 31 | Request = request; 32 | Code = code; 33 | RawBody = raw; 34 | } 35 | 36 | /// 37 | public IHttpRequest Request { get; private set; } 38 | 39 | /// 40 | public int Code { get; private set; } 41 | 42 | /// 43 | public string Body 44 | { 45 | get 46 | { 47 | if (bodyString == null) 48 | { 49 | ReadBody(); 50 | } 51 | 52 | return bodyString; 53 | } 54 | } 55 | 56 | /// 57 | public byte[] RawBody { get; private set; } 58 | 59 | private void ReadBody() 60 | { 61 | using (MemoryStream memory = new MemoryStream(RawBody)) 62 | { 63 | bodyString = new StreamReader(memory).ReadToEnd(); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /DreamFactory.Tests/Api/EmailApiTests.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Tests.Api 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using DreamFactory.Api; 6 | using DreamFactory.Api.Implementation; 7 | using DreamFactory.Http; 8 | using DreamFactory.Model.Email; 9 | using DreamFactory.Rest; 10 | using DreamFactory.Serialization; 11 | using Microsoft.VisualStudio.TestTools.UnitTesting; 12 | using Shouldly; 13 | 14 | [TestClass] 15 | public class EmailApiTests 16 | { 17 | [TestMethod] 18 | public void ShouldSendEmailAsync() 19 | { 20 | // Arrange 21 | IEmailApi emailApi = CreateEmailApi(); 22 | EmailRequest request = CreateEmailRequest(); 23 | 24 | // Act 25 | int count = emailApi.SendEmailAsync(request).Result; 26 | 27 | // Assert 28 | count.ShouldBe(1); 29 | } 30 | 31 | [TestMethod] 32 | public void ShouldThrowExceptions() 33 | { 34 | // Arrange 35 | IEmailApi emailApi = CreateEmailApi(); 36 | 37 | // Act & Assert 38 | Should.Throw(() => emailApi.SendEmailAsync(null)); 39 | } 40 | 41 | private static IEmailApi CreateEmailApi() 42 | { 43 | IHttpFacade httpFacade = new TestDataHttpFacade(); 44 | HttpAddress address = new HttpAddress("http://base_address", RestApiVersion.V1); 45 | HttpHeaders headers = new HttpHeaders(); 46 | return new EmailApi(address, httpFacade, new JsonContentSerializer(), headers, "email"); 47 | } 48 | 49 | private static EmailRequest CreateEmailRequest() 50 | { 51 | EmailAddress address = new EmailAddress { Email = "motodrug@gmail.com" }; 52 | return new EmailRequest { To = new List { address }, Subject = "Hello from the demo!", BodyText = "Hello, moto!" }; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemAppApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.App; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/app API. 10 | /// 11 | public interface ISystemAppApi 12 | { 13 | /// 14 | /// Retrieve one or more applications. 15 | /// 16 | /// Query parameters. 17 | /// List of applications. 18 | Task> GetAppsAsync(SqlQuery query); 19 | 20 | /// 21 | /// Create one or more applications. 22 | /// 23 | /// Query parameters. 24 | /// Applications to create. 25 | /// List of created applications. 26 | Task> CreateAppsAsync(SqlQuery query, params AppRequest[] apps); 27 | 28 | /// 29 | /// Update one or more applications. 30 | /// 31 | /// Query parameters. 32 | /// Applications to update. 33 | /// List of updated applications. 34 | Task> UpdateAppsAsync(SqlQuery query, params AppRequest[] apps); 35 | 36 | /// 37 | /// Delete one or more applications. 38 | /// 39 | /// Query parameters. 40 | /// Application IDs to delete. 41 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 42 | Task> DeleteAppsAsync(SqlQuery query, params int[] ids); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemCorsApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.Cors; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/cors API. 10 | /// 11 | public interface ISystemCorsApi 12 | { 13 | /// 14 | /// Retrieve one or more CORS record. 15 | /// 16 | /// Query parameters. 17 | /// List of CORS records. 18 | Task> GetCorsAsync(SqlQuery query); 19 | 20 | /// 21 | /// Create one or more CORS record. 22 | /// 23 | /// Query parameters. 24 | /// CORS records to create. 25 | /// List of CORS records. 26 | Task> CreateCorsAsync(SqlQuery query, params CorsRequest[] records); 27 | 28 | /// 29 | /// Update one or more CORS record. 30 | /// 31 | /// Query parameters. 32 | /// CORS records to update. 33 | /// List of CORS records. 34 | Task> UpdateCorsAsync(SqlQuery query, params CorsRequest[] records); 35 | 36 | /// 37 | /// Delete one or more CORS record. 38 | /// 39 | /// Query parameters. 40 | /// CORS records IDs to delete. 41 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 42 | Task> DeleteCorsAsync(SqlQuery query, params int[] ids); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.Lookup.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.Lookup; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetLookupsAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "lookup", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | 23 | public Task> CreateLookupsAsync(SqlQuery query, params LookupRequest[] Lookups) 24 | { 25 | return base.RequestWithPayloadAsync( 26 | method: HttpMethod.Post, 27 | resource: "lookup", 28 | query: query, 29 | payload: Lookups 30 | ); 31 | } 32 | 33 | public Task> UpdateLookupsAsync(SqlQuery query, params LookupRequest[] Lookups) 34 | { 35 | return base.RequestWithPayloadAsync( 36 | method: HttpMethod.Patch, 37 | resource: "lookup", 38 | query: query, 39 | payload: Lookups 40 | ); 41 | } 42 | 43 | public Task> DeleteLookupsAsync(SqlQuery query, params int[] ids) 44 | { 45 | return base.RequestDeleteAsync( 46 | resource: "Lookup", 47 | query: query, 48 | force: false, 49 | ids: ids 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Model/Builder/IStoreProcParamsBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Model.Builder 2 | { 3 | using DreamFactory.Model.Database; 4 | 5 | /// 6 | /// Represents a builder of array. 7 | /// 8 | public interface IStoreProcParamsBuilder 9 | { 10 | /// 11 | /// Adds IN parameter. 12 | /// 13 | /// Name of the parameter. 14 | /// Value of the parameter. 15 | /// Type of the parameter. 16 | /// Interface chaining. 17 | IStoreProcParamsBuilder WithInParam(string name, TParam value); 18 | 19 | /// 20 | /// Adds INOUT parameter. 21 | /// 22 | /// Name of the parameter. 23 | /// Value of the parameter. 24 | /// The requested length for the returned value. 25 | /// Type of the parameter. 26 | /// Interface chaining. 27 | IStoreProcParamsBuilder WithInOutParam(string name, TParam value = default(TParam), int? length = null); 28 | 29 | /// 30 | /// Adds OUT parameter. 31 | /// 32 | /// Name of the parameter. 33 | /// The requested length for the returned value. 34 | /// Type of the parameter. 35 | /// Interface chaining. 36 | IStoreProcParamsBuilder WithOutParam(string name, int? length = null); 37 | 38 | /// 39 | /// Builds the array of . 40 | /// 41 | /// Array of . 42 | StoredProcParam[] Build(); 43 | } 44 | } -------------------------------------------------------------------------------- /DreamFactory/Api/Implementation/SystemApi.Service.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api.Implementation 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using DreamFactory.Http; 6 | using DreamFactory.Model; 7 | using DreamFactory.Model.Database; 8 | using DreamFactory.Model.System.Service; 9 | 10 | internal partial class SystemApi 11 | { 12 | public async Task> GetServicesAsync(SqlQuery query) 13 | { 14 | ResourceWrapper response = await base.RequestAsync>( 15 | method: HttpMethod.Get, 16 | resource: "service", 17 | query: query 18 | ); 19 | 20 | return response.Records; 21 | } 22 | 23 | public Task> CreateServicesAsync(SqlQuery query, params ServiceRequest[] services) 24 | { 25 | return base.RequestWithPayloadAsync( 26 | method: HttpMethod.Post, 27 | resource: "service", 28 | query: query, 29 | payload: services 30 | ); 31 | } 32 | 33 | public Task> UpdateServicesAsync(SqlQuery query, params ServiceRequest[] services) 34 | { 35 | return base.RequestWithPayloadAsync( 36 | method: HttpMethod.Patch, 37 | resource: "service", 38 | query: query, 39 | payload: services 40 | ); 41 | } 42 | 43 | public Task> DeleteServicesAsync(SqlQuery query, params int[] ids) 44 | { 45 | return base.RequestDeleteAsync( 46 | resource: "service", 47 | query: query, 48 | force: false, 49 | ids: ids 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemServiceApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.Service; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/service API. 10 | /// 11 | public interface ISystemServiceApi 12 | { 13 | 14 | /// 15 | /// Retrieve one or more services. 16 | /// 17 | /// Query parameters. 18 | /// List of services. 19 | Task> GetServicesAsync(SqlQuery query); 20 | 21 | /// 22 | /// Create one or more services. 23 | /// 24 | /// Query parameters. 25 | /// Services to create. 26 | /// List of created services. 27 | Task> CreateServicesAsync(SqlQuery query, params ServiceRequest[] services); 28 | 29 | /// 30 | /// Update one or more services. 31 | /// 32 | /// Query parameters. 33 | /// Services to update. 34 | /// List of updated services. 35 | Task> UpdateServicesAsync(SqlQuery query, params ServiceRequest[] services); 36 | 37 | /// 38 | /// Delete one or more services. 39 | /// 40 | /// Query parameters. 41 | /// Service IDs to delete. 42 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 43 | Task> DeleteServicesAsync(SqlQuery query, params int[] ids); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Contact/List.cshtml: -------------------------------------------------------------------------------- 1 | @using DreamFactory.AddressBook.Extensions 2 | @using DreamFactory.AddressBook.Models.Entities 3 | @model IEnumerable 4 | 5 | @{ 6 | ViewBag.Title = string.IsNullOrEmpty(ViewBag.GroupName) ? "Contacts in all groups" : "Contacts in '" + ViewBag.GroupName + "' group"; 7 | } 8 | 9 |

@ViewBag.Title

10 |
11 | @if (!string.IsNullOrEmpty(Request.QueryString["GroupId"])) 12 | { 13 | Add new contact 14 | } 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | @foreach (Contact contact in Model) 29 | { 30 | 31 | 32 | 33 | 41 | 42 | } 43 | @if (!Model.Any()) 44 | { 45 | 46 | } 47 | 48 |
@Html.Label("Id")@Html.Label("Name")@Html.Label("Action")
@contact.Id@contact.FirstName @contact.LastName 34 | 35 | View 36 | 37 | 38 | Edit 39 | 40 |
No records found.
49 | 50 | @Html.Partial("Paging", "Contact") 51 | -------------------------------------------------------------------------------- /DreamFactory.AddressBook/Views/Shared/Paging.cshtml: -------------------------------------------------------------------------------- 1 | @using DreamFactory.AddressBook.Extensions 2 | 3 |
4 |
    5 | @if (ViewBag.Page == 1) 6 | { 7 |
  • 8 | 9 | 10 | 11 |
  • 12 | } 13 | else 14 | { 15 |
  • 16 | 17 | 18 | 19 |
  • 20 | } 21 | 22 | @for (int i = 0; i < (ViewBag.TotalResults / ViewBag.PageSize) + (ViewBag.TotalResults % ViewBag.PageSize == 0 && ViewBag.TotalResults != 0 ? 0 : 1); i++) 23 | { 24 | if (ViewBag.Page == i + 1) 25 | { 26 |
  • 27 | @(i + 1) 28 |
  • 29 | } 30 | else 31 | { 32 |
  • 33 | @(i + 1) 34 |
  • 35 | } 36 | } 37 | 38 | @if (ViewBag.Page == ViewBag.TotalResults/ViewBag.PageSize + 1) 39 | { 40 |
  • 41 | 42 | 43 | 44 |
  • 45 | } 46 | else 47 | { 48 |
  • 49 | 50 | 51 | 52 |
  • 53 | } 54 | 55 |
56 |
57 | -------------------------------------------------------------------------------- /DreamFactory/Api/ISystemLookupApi.cs: -------------------------------------------------------------------------------- 1 | namespace DreamFactory.Api 2 | { 3 | using DreamFactory.Model.Database; 4 | using DreamFactory.Model.System.Lookup; 5 | using global::System.Collections.Generic; 6 | using global::System.Threading.Tasks; 7 | 8 | /// 9 | /// Represents /system/lookup API. 10 | /// 11 | public interface ISystemLookupApi 12 | { 13 | /// 14 | /// Retrieve one or more lookup record. 15 | /// 16 | /// Query parameters. 17 | /// List of lookup records. 18 | Task> GetLookupsAsync(SqlQuery query); 19 | 20 | /// 21 | /// Create one or more lookup record. 22 | /// 23 | /// Query parameters. 24 | /// Lookup records to create. 25 | /// List of lookup records. 26 | Task> CreateLookupsAsync(SqlQuery query, params LookupRequest[] records); 27 | 28 | /// 29 | /// Update one or more lookup record. 30 | /// 31 | /// Query parameters. 32 | /// Lookup records to update. 33 | /// List of lookup records. 34 | Task> UpdateLookupsAsync(SqlQuery query, params LookupRequest[] records); 35 | 36 | /// 37 | /// Delete one or more lookup record. 38 | /// 39 | /// Query parameters. 40 | /// Lookup records IDs to delete. 41 | /// By default, only the id property of the record deleted is returned on success. Use 'fields' and 'related' to return more properties of the deleted records. 42 | Task> DeleteLookupsAsync(SqlQuery query, params int[] ids); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DreamFactory.Tests/TestData/rest/files/calendar/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "container": "applications", 3 | "name": "calendar", 4 | "path": "applications/calendar/", 5 | "last_modified": "Thu, 16 Apr 2015 14:27:45 GMT", 6 | "folder": [ 7 | { 8 | "path": "applications/calendar/css/", 9 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 10 | "name": "css" 11 | }, 12 | { 13 | "path": "applications/calendar/js/", 14 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 15 | "name": "js" 16 | } 17 | ], 18 | "file": [ 19 | { 20 | "path": "applications/calendar/css/prettify.css", 21 | "content_type": "text/css", 22 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 23 | "content_length": 1400, 24 | "name": "css/prettify.css" 25 | }, 26 | { 27 | "path": "applications/calendar/css/style.css", 28 | "content_type": "text/css", 29 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 30 | "content_length": 60102, 31 | "name": "css/style.css" 32 | }, 33 | { 34 | "path": "applications/calendar/index.html", 35 | "content_type": "text/html", 36 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 37 | "content_length": 7352, 38 | "name": "index.html" 39 | }, 40 | { 41 | "path": "applications/calendar/js/actions.js", 42 | "content_type": "application/javascript", 43 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 44 | "content_length": 11254, 45 | "name": "js/actions.js" 46 | }, 47 | { 48 | "path": "applications/calendar/js/prettify.js", 49 | "content_type": "application/javascript", 50 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 51 | "content_length": 13632, 52 | "name": "js/prettify.js" 53 | }, 54 | { 55 | "path": "applications/calendar/js/utils.js", 56 | "content_type": "application/javascript", 57 | "last_modified": "Fri, 27 Mar 2015 12:10:56 GMT", 58 | "content_length": 2284, 59 | "name": "js/utils.js" 60 | } 61 | ] 62 | } --------------------------------------------------------------------------------