Describes the Portal or Mesh data to be retreived.
Наследование: MeshRequest
Пример #1
0
        /// <summary>
        /// Get the active profile associated with the current account.
        /// </summary>
        /// <returns>The signed personal profile.</returns>
        public SignedPersonalProfile GetPersonalProfile() {
            if (AccountID == null) return null;

            var GetRequest = new GetRequest ();
            GetRequest.Account = AccountID;
            GetRequest.Multiple = false;

            var GetResponse = MeshService.Get(GetRequest);

            if (GetResponse.Entries.Count == 0) { return null; }

            _SignedPersonalProfile = GetResponse.Entries[0] as SignedPersonalProfile;

            if (PersonalProfile != null) {
                PersonalProfile.SignedDeviceProfile = SignedDeviceProfile;
                }
            return _SignedPersonalProfile;
            }
Пример #2
0
        /// <summary>
        /// Retrieve an application profile by unique ID.
        /// </summary>
        /// <param name="ID">the unique id of the profile.</param>
        /// <returns>The signed application profile if found, otherwise null.</returns>
        public SignedApplicationProfile GetApplicationProfile (string ID) {

            var GetRequest = new GetRequest();
            GetRequest.Identifier = ID;
            GetRequest.Multiple = false;

            var GetResponse = MeshService.Get(GetRequest);
            if (GetResponse.Entries == null) { return null; }
            if (GetResponse.Entries.Count == 0) { return null; }

            var SignedApplicationProfile = GetResponse.Entries[0] as SignedApplicationProfile;
            if (SignedApplicationProfile == null) { return null; }

            return SignedApplicationProfile;
            }
Пример #3
0
        /// <summary>
        /// Deserialize a tagged stream
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <returns>The created object.</returns>		
        public static new MeshRequest  FromTagged (JSONReader JSONReader) {
			MeshRequest Out = null;

			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                return null;
                }

			string token = JSONReader.ReadToken ();

			switch (token) {

				case "MeshRequest" : {
					var Result = new MeshRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "HelloRequest" : {
					var Result = new HelloRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ValidateRequest" : {
					var Result = new ValidateRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "CreateRequest" : {
					var Result = new CreateRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "GetRequest" : {
					var Result = new GetRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "PublishRequest" : {
					var Result = new PublishRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "StatusRequest" : {
					var Result = new StatusRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectStartRequest" : {
					var Result = new ConnectStartRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectStartResponse" : {
					var Result = new ConnectStartResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectStatusRequest" : {
					var Result = new ConnectStatusRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectStatusResponse" : {
					var Result = new ConnectStatusResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectPendingRequest" : {
					var Result = new ConnectPendingRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectPendingResponse" : {
					var Result = new ConnectPendingResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectCompleteRequest" : {
					var Result = new ConnectCompleteRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "ConnectCompleteResponse" : {
					var Result = new ConnectCompleteResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				case "TransferRequest" : {
					var Result = new TransferRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					//Ignore the unknown data
                    //throw new Exception ("Not supported");
                    break;
					}
				}
			JSONReader.EndObject ();

			return Out;
			}
Пример #4
0
        /// <summary>
        /// Recover an offline escrow entry
        /// </summary>
        /// <param name="Identifier">The UDF of the decryption key</param>
        /// <returns>Offline escrow entry (if found), null otherwise.</returns>
        public OfflineEscrowEntry Recover (string Identifier) {
            var GetRequest = new GetRequest();
            GetRequest.Identifier = Identifier;
            GetRequest.Multiple = false;
            var GetResponse = MeshService.Get(GetRequest);

            if (GetResponse.Entries.Count == 0) { return null; }

            var Result = GetResponse.Entries[0] as OfflineEscrowEntry;

            return Result;
            }
Пример #5
0
		/// <summary>
        /// Construct an instance from the specified tagged JSONReader stream.
        /// </summary>
        /// <param name="JSONReader">Input stream</param>
        /// <param name="Out">The created object</param>
        public static void Deserialize(JSONReader JSONReader, out JSONObject Out) {
	
			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                Out = null;
                return;
                }

			string token = JSONReader.ReadToken ();
			Out = null;

			switch (token) {

				case "MeshRequest" : {
					var Result = new MeshRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "MeshResponse" : {
					var Result = new MeshResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "Version" : {
					var Result = new Version ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "Encoding" : {
					var Result = new Encoding ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "KeyValue" : {
					var Result = new KeyValue ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SearchConstraints" : {
					var Result = new SearchConstraints ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "HelloRequest" : {
					var Result = new HelloRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "HelloResponse" : {
					var Result = new HelloResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ValidateRequest" : {
					var Result = new ValidateRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ValidateResponse" : {
					var Result = new ValidateResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "CreateRequest" : {
					var Result = new CreateRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "CreateResponse" : {
					var Result = new CreateResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "GetRequest" : {
					var Result = new GetRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "GetResponse" : {
					var Result = new GetResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "PublishRequest" : {
					var Result = new PublishRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "PublishResponse" : {
					var Result = new PublishResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "StatusRequest" : {
					var Result = new StatusRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "StatusResponse" : {
					var Result = new StatusResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectStartRequest" : {
					var Result = new ConnectStartRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectStartResponse" : {
					var Result = new ConnectStartResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectStatusRequest" : {
					var Result = new ConnectStatusRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectStatusResponse" : {
					var Result = new ConnectStatusResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectPendingRequest" : {
					var Result = new ConnectPendingRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectPendingResponse" : {
					var Result = new ConnectPendingResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectCompleteRequest" : {
					var Result = new ConnectCompleteRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectCompleteResponse" : {
					var Result = new ConnectCompleteResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "TransferRequest" : {
					var Result = new TransferRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "TransferResponse" : {
					var Result = new TransferResponse ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					throw new Exception ("Not supported");
					}
				}	
			JSONReader.EndObject ();
            }
Пример #6
0
        /// <summary>
		/// Implement the transaction
        /// </summary>		
        /// <param name="Request">The request object</param>
		/// <returns>The response object</returns>
        public override GetResponse Get (
                GetRequest Request) {

            var ResponseData = JPCRemoteSession.Post("Get", Request);
            var Response = GetResponse.FromTagged(ResponseData);

            return Response;
            }
Пример #7
0
        /// <summary>
		/// Base method for implementing the transaction  Get.
        /// </summary>
        /// <param name="Request">The request object to send to the host.</param>
		/// <returns>The response object from the service</returns>
        public virtual GetResponse Get (
                GetRequest Request) {
            return null;
            }
Пример #8
0
        /// <summary>
        /// Deserialize a tagged stream
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <returns>The created object.</returns>		
        public static new GetRequest  FromTagged (JSONReader JSONReader) {
			GetRequest Out = null;

			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                return null;
                }

			string token = JSONReader.ReadToken ();

			switch (token) {

				case "GetRequest" : {
					var Result = new GetRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					//Ignore the unknown data
                    //throw new Exception ("Not supported");
                    break;
					}
				}
			JSONReader.EndObject ();

			return Out;
			}
Пример #9
0
        /// <summary>
		/// Base class for implementing the transaction.
        /// </summary>		
        /// <param name="Request">The request object to send to the host.</param>
		/// <returns>The response object from the service</returns>
        public override GetResponse Get(
                GetRequest Request) {
            var Response = new GetResponse();

            if (Request.Account != null) {
                var Account = Mesh.GetAccount(Request.Account);
                if (Account == null) return Response;

                var Profile = Mesh.GetSignedPersonalProfile(Account.UserProfileUDF);

                var EntryDatas = new List<Entry> { Profile };
                Response.Entries = EntryDatas;
                }
            else if (Request.Identifier != null) {

                var Profile = Mesh.GetProfile (Request.Identifier);
                if (Profile == null) return Response;

                var EntryDatas = new List<Entry> { Profile };
                Response.Entries = EntryDatas;
                }

            return Response;
            }