コード例 #1
0
        public object Post(InitializationRequest request)
        {
            Log.Debug("starting Post(RealEstateServicesInitializationRequest request)");
            InitializationRequestPayload initializationRequestPayload = request.InitializationRequestPayload;

            Log.Debug($"You sent me InitializationRequestPayload = {initializationRequestPayload}");

            // Initialize a machine datastructure for this service/user/session/connection
            // Initialize a user datastructure for this service/user/session/connection

            //ToDo: the ConfigurationData structure need to be initialized in the plug startup code, and stored in teh Data instance, and this routine just copies those values
            //ToDO: remove this temporary delay
            Thread.Sleep(5000);
            // populate the ConfigurationData response structures
            string            google_API_URI           = (RealEstateServicesData.Google_API_URI != null) ? RealEstateServicesData.Google_API_URI : "HTTP://GoogleAPIURINotDefined.com/";
            string            homeAway_API_URI_API_URI = (RealEstateServicesData.HomeAway_API_URI != null) ? RealEstateServicesData.HomeAway_API_URI : "HTTP://HomeAwayAPIURINotDefined.com/";
            ConfigurationData configurationData        = new ConfigurationData(google_API_URI, homeAway_API_URI_API_URI);
            // populate the UserData response structures
            string   googleAPIKeyEncrypted    = (RealEstateServicesData.GoogleAPIKeyEncrypted != null) ? RealEstateServicesData.GoogleAPIKeyEncrypted : "GoogleAPIKeyEncrypted needed";
            string   googleAPIKeyPassPhrase   = (RealEstateServicesData.GoogleAPIKeyPassPhrase != null) ? RealEstateServicesData.GoogleAPIKeyPassPhrase : "GoogleAPIKeyPassPhrase needed";
            string   homeAwayAPIKeyEncrypted  = (RealEstateServicesData.HomeAwayAPIKeyEncrypted != null) ? RealEstateServicesData.HomeAwayAPIKeyEncrypted : "HomeAwayAPIKeyEncrypted needed";
            string   homeAwayAPIKeyPassPhrase = (RealEstateServicesData.HomeAwayAPIKeyPassPhrase != null) ? RealEstateServicesData.HomeAwayAPIKeyPassPhrase : "HomeAwayAPIKeyPassPhrase needed";
            UserData userData = new UserData(googleAPIKeyEncrypted, homeAwayAPIKeyEncrypted, googleAPIKeyPassPhrase, homeAwayAPIKeyPassPhrase);

            // Create and populate the InitializationResponse data structure
            InitializationResponse initializationResponse = new InitializationResponse(new InitializationResponsePayload(configurationData, userData));

            // return information about this service/user/session
            Log.Debug($"leaving Post(InitializationRequest request), returning initializationResponse = {initializationResponse}");
            return(initializationResponse);
        }
コード例 #2
0
 public InitializationRequest(InitializationRequestPayload initializationRequestPayload)
 {
     InitializationRequestPayload = initializationRequestPayload ?? throw new ArgumentNullException(nameof(initializationRequestPayload));
 }