Exemple #1
0
        public async Task <IList <Image> > ListImages(ListImagesQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            var response = await client
                           .MakeRequestAsync(client.NoErrorHandlers, HttpMethod.Get,
                                             "images/json", query.ToQueryString()).ConfigureAwait(false);

            return(client.JsonSerializer.DeserializeObject <Image[]>(response.Body));
        }
Exemple #2
0
        public static ListImagesQuery WithLabel(this ListImagesQuery query,
                                                string label, string op = LabelOperators.Applied, string value = "")
        {
            if (string.IsNullOrWhiteSpace(label))
            {
                throw new ArgumentNullException(nameof(label));
            }

            var exp = label;

            if (op != LabelOperators.Applied)
            {
                exp = $"{exp}{op}{value}";
            }

            if (!query.Labels.Contains(exp))
            {
                query.Labels.Add(exp);
            }

            return(query);
        }
Exemple #3
0
 public static ListImagesQuery WithName(this ListImagesQuery query, string name)
 {
     query.Name = name;
     return(query);
 }
Exemple #4
0
 public static ListImagesQuery WithDangling(this ListImagesQuery query, bool dangling = true)
 {
     query.Dangling = dangling;
     return(query);
 }
Exemple #5
0
 public static ListImagesQuery GetAll(this ListImagesQuery query, bool all = true)
 {
     query.All = all;
     return(query);
 }
Exemple #6
0
 public static ListImagesQuery Before(this ListImagesQuery query, string before)
 {
     query.Before = before;
     return(query);
 }
Exemple #7
0
 public static ListImagesQuery Since(this ListImagesQuery query, string since)
 {
     query.Since = since;
     return(query);
 }