public async Task UpdateActivities(IEnumerable<Activity> activities) { var request = _client.BuildJWTAppRequest("activities/", HttpMethod.POST); request.SetJsonBody(Activity.ToActivitiesJson(activities, this._client)); var response = await this._client.MakeRequest(request); if (response.StatusCode != System.Net.HttpStatusCode.Created) throw StreamException.FromResponse(response); }
/// <summary> /// Add a list of activities /// </summary> /// <param name="activities"></param> /// <returns></returns> public async Task <IEnumerable <Activity> > AddActivities(IEnumerable <Activity> activities) { if (activities.SafeCount() == 0) { throw new ArgumentNullException("activities", "Must have activities to add"); } var request = _client.BuildFeedRequest(this, "/", HttpMethod.POST); request.SetJsonBody(Activity.ToActivitiesJson(activities, this._client)); var response = await _client.MakeRequest(request); if (response.StatusCode == System.Net.HttpStatusCode.Created) { return(Activity.GetResults(response.Content)); } throw StreamException.FromResponse(response); }
/// <summary> /// Update a list of activities, Maximum length is 100 /// </summary> /// <param name="activities"></param> /// <returns></returns> public async Task UpdateActivities(IEnumerable <Activity> activities) { if (activities.SafeCount() == 0) { throw new ArgumentNullException("activities", "Must have activities to add"); } if (activities.SafeCount() > 100) { throw new ArgumentNullException("activities", "Maximum length is 100"); } var request = _client.BuildActivitiesRequest(this); request.SetJsonBody(Activity.ToActivitiesJson(activities, this._client)); var response = await _client.MakeRequest(request); if (response.StatusCode != System.Net.HttpStatusCode.Created) { throw StreamException.FromResponse(response); } }