예제 #1
0
        /// <summary>
        /// Creates a new Chino Application on the server
        /// </summary>
        /// <param name="client">The <see cref="RestClient"/> to use for communication</param>
        /// <param name="name">The <see cref="ChinoApplication.Name"/> of the application</param>
        /// <param name="grantType">The <see cref="ApplicationGrantType"/> for the ne application</param>
        /// <param name="redirectUrl">The Uri to return after successful login</param>
        /// <returns>The <see cref="ChinoApplication"/></returns>
        public static ChinoApplication Create(RestClient client, string name, ApplicationGrantType grantType, string redirectUrl)
        {
            var request = new RestRequest("/auth/applications", Method.POST);
            var createApplicationRequest = new CreateApplicationRequest
            {
                Name        = name,
                GrantType   = grantType,
                RedirectUrl = redirectUrl
            };

            var response = Rest.Execute <ReadApplicationResponse>(client, request, createApplicationRequest);

            return(response.Data.Application);
        }
예제 #2
0
 /// <summary>
 /// Updates the name and <see cref="ApplicationGrantType"/> of an application
 /// </summary>
 /// <param name="id">the id of the application to update</param>
 /// <param name="name">the new name to set</param>
 /// <param name="grantType">the grant type to set for the application</param>
 /// <returns>the updated <see cref="ChinoApplication"/></returns>
 /// <exception cref="ChinoApiException">thrown by the api server, when recieving incorrect request data</exception>
 public ChinoApplication Update(string id, string name, ApplicationGrantType grantType)
 {
     return(this.Update(id, name, grantType, string.Empty));
 }
예제 #3
0
 /// <summary>
 /// Creates a new Chino Application on the api server
 /// </summary>
 /// <param name="name">the name or description of the application</param>
 /// <param name="grantType">the <see cref="ApplicationGrantType"/> to use for user logins</param>
 /// <param name="redirectUrl">the url to return after successful login. Requires <see cref="ApplicationGrantType.authorization_code"/>.</param>
 /// <returns>the newly generated <see cref="ChinoApplication"/></returns>
 /// <exception cref="ChinoApiException">thrown by the api server, when recieving incorrect request data</exception>
 public ChinoApplication Create(string name, ApplicationGrantType grantType, string redirectUrl)
 {
     return(ChinoApplication.Create(this.client, name, grantType, redirectUrl));
 }