Example #1
0
        /// <summary>
        /// Initialises a new instance of the request with the given description.
        /// </summary>
        ///
        /// <param name="desc">The description.</param>
        /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param>
        /// <param name="serverUrl">The server url for this call.</param>
        public SendMessageRequest(SendMessageRequestDesc desc, string connectAccessToken, string serverUrl)
        {
            ReleaseAssert.IsNotNull(desc, "A description object cannot be null.");

            ReleaseAssert.IsNotNull(desc.To, "To cannot be null.");

            ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null.");

            To    = desc.To;
            From  = desc.From;
            Title = desc.Title;
            Text  = desc.Text;
            Data  = desc.Data;
            if (desc.Tags != null)
            {
                Tags = Mutability.ToImmutable(desc.Tags);
            }
            Expiry             = desc.Expiry;
            Gifts              = desc.Gifts;
            Transfer           = desc.Transfer;
            ConnectAccessToken = connectAccessToken;

            Url = serverUrl + "/1.0/message/send";
            HttpRequestMethod = HttpRequestMethod.Post;
        }
Example #2
0
        /// <summary>
        /// Initialises a new instance of the request with the given description.
        /// </summary>
        ///
        /// <param name="desc">The description.</param>
        /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param>
        public SendMessageFromPlayerRequest(SendMessageFromPlayerRequestDesc desc, string connectAccessToken)
        {
            ReleaseAssert.IsNotNull(desc, "A description object cannot be null.");

            ReleaseAssert.IsNotNull(desc.To, "To cannot be null.");

            ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null.");

            To    = desc.To;
            Title = desc.Title;
            Text  = desc.Text;
            Data  = desc.Data;
            if (desc.Tags != null)
            {
                Tags = Mutability.ToImmutable(desc.Tags);
            }
            Expiry             = desc.Expiry;
            Transfer           = desc.Transfer;
            ConnectAccessToken = connectAccessToken;

            Url = "https://connect.chilliconnect.com/1.0/message/player/send";
            HttpRequestMethod = HttpRequestMethod.Post;
        }