コード例 #1
0
ファイル: Ledger.cs プロジェクト: fsreyes/indy-sdk
        /// <summary>
        /// Builds a GET_SCHEMA ledger request.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Builds a request message that is suitable for requesting a schema from a ledger.
        /// </para>
        /// <para>
        /// The <paramref name="data"/> parameter must contain a JSON string with the members "name",
        /// and "version" specifying the schema to get.  For example the following JSON describes
        /// a request for a schema with the name "access" that is version 1.0:
        /// <code>
        /// {
        ///     "name":"access",
        ///     "version":"1.0"
        /// }
        /// </code>
        /// </para>
        /// </remarks>
        /// <param name="submitterDid">The DID of the party that will submit the request.</param>
        /// <param name="dest">The DID of the destination.</param>
        /// <param name="data">A JSON string specifying what schema to get.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> that resolves to a <see cref="string"/>
        /// containing the request JSON. </returns>
        public static Task <string> BuildGetSchemaRequestAsync(string submitterDid, string dest, string data)
        {
            var taskCompletionSource = new TaskCompletionSource <string>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var result = IndyNativeMethods.indy_build_get_schema_request(
                commandHandle,
                submitterDid,
                dest,
                data,
                _buildRequestCallback
                );

            CallbackHelper.CheckResult(result);

            return(taskCompletionSource.Task);
        }