/// <summary> /// Creates a new API App. /// </summary> /// <param name="app">The application.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">app</exception> public Task <ApiAppResponse> CreateApiAppAsync(NewApiApp app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } var content = new MultipartFormDataContent(); content.AddApiApp(_log, app); return(PostAsync <ApiAppResponse>(ApiAppUrl, content)); }
/// <summary> /// Updates an existing API App. Can only be invoked for apps you own. /// Only the fields you provide will be updated. If you wish to clear an existing optional field, /// provide an empty string. /// </summary> /// <param name="clientId">The client identifier.</param> /// <param name="app">The application.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">app</exception> public Task <ApiAppResponse> UpdateApiAppAsync(string clientId, NewApiApp app) { if (string.IsNullOrEmpty(clientId)) { throw new ArgumentException("Client id is required."); } if (app == null) { throw new ArgumentNullException(nameof(app)); } var content = new MultipartFormDataContent(); content.AddApiApp(_log, app); return(PostAsync <ApiAppResponse>($"{ApiAppUrl}/{clientId}", content)); }
public static void AddApiApp(this MultipartFormDataContent content, IApiLog log, NewApiApp app) { content.AddParameter(log, "name", app.Name); content.AddParameter(log, "domain", app.Domain); content.AddParameter(log, "callback_url", app.CallbackUrl); content.AddParameter(log, "custom_logo_file", app.CustomLogoFile); content.AddParameter(log, "oauth[callback_url]", app.OAuthCallbackUrl); content.AddParameter(log, "oauth[scopes]", app.OAuthScopes); content.AddParameter(log, "white_labeling_options", app.WhiteLabelingOptions); }