Skip to content

Commit

Permalink
Merge pull request #20 from nkSebastianG/feature/sg-minor-additions-a…
Browse files Browse the repository at this point in the history
…nd-fixes

Feature/sg minor additions and fixes
  • Loading branch information
Daniel Sequeira committed Nov 28, 2019
2 parents 661952f + 00bfbff commit 505276f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 3 deletions.
13 changes: 13 additions & 0 deletions Bynder/Sdk/Model/OrderByType.cs
@@ -0,0 +1,13 @@
namespace Bynder.Sdk.Model
{
public static class OrderByType
{
public static readonly string DateCreatedAscending = "dateCreated asc";

public static readonly string DateCreatedDescending = "dateCreated desc";

public static readonly string NameAscending = "name asc";

public static readonly string NameDescending = "name desc";
}
}
20 changes: 19 additions & 1 deletion Bynder/Sdk/Query/Asset/MediaQuery.cs
@@ -1,4 +1,4 @@
// Copyright (c) Bynder. All rights reserved.
// Copyright (c) Bynder. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
Expand All @@ -25,6 +25,24 @@ public class MediaQuery
[ApiField("subBrandId")]
public string SubBrandId { get; set; }

/// <summary>
/// Category id. Specify this property if you want only media for specific category.
/// </summary>
[ApiField("categoryId")]
public string CategoryId { get; set; }

/// <summary>
/// Collection id. Specify this property if you want only media for specific collection.
/// </summary>
[ApiField("collectionId")]
public string CollectionId { get; set; }

/// <summary>
/// List of asset ids. Will return an asset for each existing id.
/// </summary>
[ApiField("ids", Converter = typeof(ListConverter))]
public IEnumerable<string> Ids { get; set; }

/// <summary>
/// Limit of results per request. Max 1000. Default 50.
/// </summary>
Expand Down
43 changes: 42 additions & 1 deletion Bynder/Sdk/Query/Collection/GetCollectionsQuery.cs
@@ -1,10 +1,14 @@
// Copyright (c) Bynder. All rights reserved.
// Copyright (c) Bynder. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.

using Bynder.Sdk.Query.Decoder;

namespace Bynder.Sdk.Query.Collection
{
using System.Collections.Generic;

using Bynder.Sdk.Api.Converters;

/// <summary>
/// Query to retrieve a list of collections
/// </summary>
Expand All @@ -21,5 +25,42 @@ public class GetCollectionsQuery
/// </summary>
[ApiField("page")]
public int? Page { get; set; }

/// <summary>
/// <para>Desired order of returned collection set.</para>
/// <para>See <see cref="Bynder.Sdk.Model.OrderByType"/> for possible values.</para>
/// </summary>
[ApiField("orderBy")]
public string OrderBy { get; set; }

/// <summary>
/// List of collection ids. Will return the collection for each existing collection.
/// </summary>
[ApiField("ids", Converter = typeof(ListConverter))]
public IEnumerable<string> Ids { get; set; }

/// <summary>
/// Indicates whether or not the response should include count results.
/// </summary>
[ApiField("count")]
public bool? Count { get; set; }

/// <summary>
/// Search on matching names.
/// </summary>
[ApiField("keyword")]
public string Keyword { get; set; }

/// <summary>
/// Indicates whether or not the return should only contain collections marked as public.
/// </summary>
[ApiField("isPublic")]
public bool? IsPublic { get; set; }

/// <summary>
/// Minimum collectionCount that the returned collections should have.
/// </summary>
[ApiField("minCount")]
public int? MinCount { get; set; }
}
}
7 changes: 6 additions & 1 deletion Bynder/Sdk/Service/Asset/AssetService.cs
@@ -1,4 +1,4 @@
// Copyright (c) Bynder. All rights reserved.
// Copyright (c) Bynder. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.

using System;
Expand Down Expand Up @@ -130,6 +130,11 @@ public Task UploadFileAsync(UploadQuery query)
/// <returns>Check <see cref="IAssetService"/> for more information</returns>
public Task<Media> GetMediaInfoAsync(MediaInformationQuery query)
{
if (string.IsNullOrEmpty(query.MediaId))
{
throw new ArgumentNullException(nameof(query), "Parameter cannot be null or empty.");
}

var request = new ApiRequest<Media>
{
Path = $"/api/v4/media/{query.MediaId}/",
Expand Down

0 comments on commit 505276f

Please sign in to comment.