Ejemplo n.º 1
0
 public Task <ContentShare> CreateContentShare([NotNull][ItemNotNull] IEnumerable <User> receivers,
                                               ContentShareType contentType,
                                               ulong contentId,
                                               ulong?senderId = null)
 {
     return(CreateContentShare(receivers.Select(r => r.Id), contentType, contentId, senderId));
 }
Ejemplo n.º 2
0
        public async Task <ContentShare> CreateContentShare([NotNull] IEnumerable <ulong> receivers,
                                                            ContentShareType contentType,
                                                            ulong contentId,
                                                            ulong?senderId = null)
        {
            var args = new List <(string, string)> {
                ("content_id", contentId.ToString()),
                ("content_type", contentType.GetApiRepresentation())
            };

            args.AddRange(receivers.Select(id => ("receiver_ids[]", id.ToString())));

            var response = await _client.PostAsync($"users/{senderId?.ToString() ?? "self"}/content_shares",
                                                   BuildHttpArguments(args));

            var model = JsonConvert.DeserializeObject <ContentShareModel>(await response.Content.ReadAsStringAsync());

            return(ContentShare.NewContentShare(this, model));
        }