Beispiel #1
0
        public IEnumerator GetLegalPoliciesByCountry(string countryCode, AgreementPolicyType agreementPolicyType, string[] tags, bool defaultOnEmpty, string accessToken,
                                                     ResultCallback <PublicPolicy[]> callback)
        {
            string functionName = "GetLegalPoliciesByCountry";

            Report.GetFunctionLog(GetType().Name, functionName);
            Assert.IsNotNull(countryCode, "Can't " + functionName + "! CountryCode parameter is null!");
            Assert.IsNotNull(accessToken, "Can't " + functionName + "! AccessToken parameter is null!");

            var request = HttpRequestBuilder
                          .CreateGet(baseUrl + "/public/policies/countries/{countryCode}")
                          .WithPathParam("countryCode", countryCode)
                          .WithQueryParam("policyType", (agreementPolicyType == AgreementPolicyType.EMPTY) ? "" : agreementPolicyType.ToString())
                          .WithQueryParam("tags", string.Join(",", tags))
                          .WithQueryParam("defaultOnEmpty", defaultOnEmpty.ToString())
                          .WithBearerAuth(accessToken)
                          .Accepts(MediaType.ApplicationJson)
                          .GetResult();

            IHttpResponse response = null;

            yield return(httpWorker.SendRequest(request, rsp => response = rsp));

            var result = response.TryParseJson <PublicPolicy[]>();

            callback.Try(result);
        }
        /// <summary>
        /// Retrieve all active latest policies based on a namespace.
        /// The country will be read from user token.
        /// </summary>
        /// <param name="namespace">Filter the responded policy by namespace</param>
        /// <param name="agreementPolicyType">Filter the responded policy by policy type. Choose the AgreementPolicyType.EMPTY if you want to be responded with all policy type.</param>
        /// <param name="defaultOnEmpty">Specify with true if you want to be responded with default country-specific policy if your requested country is not exist.</param>
        /// <param name="callback">Returns a Result that contains an array of public policy via callback when completed</param>
        public void GetLegalPolicies(string namespace_, AgreementPolicyType agreementPolicyType, string[] tags, bool defaultOnEmpty, ResultCallback <PublicPolicy[]> callback)
        {
            Report.GetFunctionLog(this.GetType().Name);

            if (session == null || session.AuthorizationToken == null)
            {
                callback.TryError(ErrorCode.IsNotLoggedIn);
                return;
            }

            coroutineRunner.Run(
                api.GetLegalPolicies(namespace_, agreementPolicyType, tags, defaultOnEmpty, session.AuthorizationToken, callback));
        }
        /// <summary>
        /// Retrieve all active latest policies based on a namespace and country.
        /// The country will be read from user token.
        /// </summary>
        /// <param name="defaultOnEmpty">Specify with true if you want to be responded with default country-specific policy if your requested country is not exist.</param>
        /// <param name="agreementPolicyType">Filter the responded policy by policy type. Choose the AgreementPolicyType.EMPTY if you want to be responded with all policy type.</param>
        /// <param name="callback">Returns a Result that contains an array of public policy via callback when completed</param>
        public void GetLegalPoliciesByCountry(string countryCode, AgreementPolicyType agreementPolicyType, bool defaultOnEmpty, ResultCallback <PublicPolicy[]> callback)
        {
            string[] tags = new string[1];

            this.GetLegalPoliciesByCountry(countryCode, agreementPolicyType, tags, defaultOnEmpty, callback);
        }
 /// <summary>
 /// Retrieve all active latest policies based on game namespace.
 /// The country will be read from user token.
 /// </summary>
 /// <param name="agreementPolicyType">Filter the responded policy by policy type. Choose the AgreementPolicyType.EMPTY if you want to be responded with all policy type.</param>
 /// <param name="tags">Filter the responded policy by tags.</param>
 /// <param name="defaultOnEmpty">Specify with true if you want to be responded with default country-specific policy if your requested country is not exist.</param>
 /// <param name="callback">Returns a Result that contains an array of public policy via callback when completed</param>
 public void GetLegalPolicies(AgreementPolicyType agreementPolicyType, string[] tags, bool defaultOnEmpty, ResultCallback <PublicPolicy[]> callback)
 {
     this.GetLegalPolicies(@namespace, agreementPolicyType, tags, defaultOnEmpty, callback);
 }
 /// <summary>
 /// Retrieve all active latest policies based on a namespace.
 /// The country will be read from user token.
 /// </summary>
 /// <param name="namespace">Filter the responded policy by namespace</param>
 /// <param name="agreementPolicyType">Filter the responded policy by policy type. Choose the AgreementPolicyType.EMPTY if you want to be responded with all policy type.</param>
 /// <param name="defaultOnEmpty">Specify with true if you want to be responded with default country-specific policy if your requested country is not exist.</param>
 /// <param name="callback">Returns a Result that contains an array of public policy via callback when completed</param>
 public void GetLegalPolicies(string namespace_, AgreementPolicyType agreementPolicyType, bool defaultOnEmpty, ResultCallback <PublicPolicy[]> callback)
 {
     string[] tags = new string[1];
     this.GetLegalPolicies(namespace_, agreementPolicyType, tags, defaultOnEmpty, callback);
 }