This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct PersonFound: Content { | |
var found: String | |
} | |
app.post("personFound") { req -> EventLoopFuture<HTTPStatus> in | |
let message = try req.content.decode(PersonFound.self) | |
let personFound = PersonFoundController() | |
personFound.sendNotification(foundPerson: message.found) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MessageRequest: Content { | |
var to: String | |
var from: String | |
var body: String | |
} | |
app.post("sms") { req -> EventLoopFuture<HTTPStatus> in | |
return try req.content.decode(MessageRequest.self).map(to: HTTPStatus.self) { messageRequest in | |
print("To: (messageRequest.to)") | |
print("From: (messageRequest.from)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version:4.0 | |
import PackageDescription | |
let package = Package( | |
name: "homeHub", | |
products: [ | |
.library(name: "homeHub", targets: ["App"]), | |
], | |
dependencies: [ | |
// 💧 A server-side Swift web framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (GUILayout.Button("TEST")) | |
{ | |
var schema = JsonSchema.FromSampleJson(File.ReadAllText(pathFolder + "/iControlDB/Models/test.json")); | |
var generator = new CSharpGenerator(schema, new CSharpGeneratorSettings()); | |
var file = generator.GenerateFile(); | |
File.WriteAllText(pathFolder + "/iControlDB/Models/company.json", file); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CreateClassfromJsonSchema() | |
{ | |
var schema = JsonSchema.FromSampleJson(File.ReadAllText(pathFolder + "/iControlDB/Models/test.json")); | |
var generator = new CSharpGenerator(schema, new CSharpGeneratorSettings()); | |
var file = generator.GenerateFile(); | |
File.WriteAllText(pathFolder + "/iControlDB/Models/company.json", file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CreateClassfromJsonSchema() | |
{ | |
var schema = JsonSchema.FromSampleJson(File.ReadAllText(pathFolder + "/iControlDB/Models/test.json")); | |
var jsonSchema = schema.ToJson(); | |
CSharpGenerator generator = new CSharpGenerator(jsonSchema); | |
var file = generator.GenerateFile("MyClass"); | |
File.WriteAllText(pathFolder + "/iControlDB/Models/company.json", file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CreateClassfromJsonSchema() | |
{ | |
var schema = JsonSchema.FromSampleJson(pathFolder + "/iControlDB/Models/test.json"); | |
var jsonSchema = schema.ToJson(); | |
CSharpGenerator generator = new CSharpGenerator(jsonSchema); | |
var file = generator.GenerateFile("MyClass"); | |
File.WriteAllText(pathFolder + "/iControlDB/Models/company.json", file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CreateClassfromJsonSchema() | |
{ | |
JObject jsonSchema = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(File.ReadAllText(pathFolder + "/iControlDB/Models/test.json")); | |
CSharpGenerator generator = new CSharpGenerator(jsonSchema); | |
var file = generator.GenerateFile("MyClass"); | |
File.WriteAllText(pathFolder + "/iControlDB/Models/company.json", file); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using WebSocketSharp; | |
using System; | |
using System.Text; | |
public class ClientManager : MonoBehaviour | |
{ | |
public WebSocket ws; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using WebSocketSharp; | |
using WebSocketSharp.Server; | |
public class ServerManager: MonoBehaviour | |
{ | |
public string serverAddress = "ws://0.0.0.0:8080"; |