Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge 6a7d4c9 into e719880
Browse files Browse the repository at this point in the history
  • Loading branch information
timwellswa committed Nov 6, 2019
2 parents e719880 + 6a7d4c9 commit 1ec2037
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 6 deletions.
11 changes: 8 additions & 3 deletions main/Smartsheet/Api/Internal/Json/ObjectValueTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// %[license]

using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using Smartsheet.Api.Models;
Expand Down Expand Up @@ -73,7 +74,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
break;

case ObjectValueType.MULTI_CONTACT:
objectValue = new MultiContactObjectValue(superset.values);
objectValue = new MultiContactObjectValue(superset.values.Select(q => JsonConvert.DeserializeObject<ContactObjectValue>(q.ToString())).ToList());
break;

case ObjectValueType.MULTI_PICKLIST:
objectValue = new MultiPicklistObjectValue(superset.values.Cast<string>().ToList());
break;

default:
Expand Down Expand Up @@ -139,8 +144,8 @@ private class ObjectValueAttributeSuperset
public int refIndex;
public string imageId;

// MULTI_CONTACT
public List<ContactObjectValue> values;
// MULTI_CONTACT or MULTI_PICKLIST
public IList<object> values;

// Various other types
public string value;
Expand Down
28 changes: 27 additions & 1 deletion main/Smartsheet/Api/Internal/SheetColumnResourcesImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,42 @@ public SheetColumnResourcesImpl(SmartsheetImpl smartsheet)
/// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
/// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
public virtual PaginatedResult<Column> ListColumns(long sheetId, IEnumerable<ColumnInclusion> include, PaginationParameters paging)
{
return this.ListColumns(sheetId, include, paging, null);
}

/// <summary>
/// <para>Gets a list of all Columns belonging to the Sheet specified in the URL.</para>
/// <para>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/columns</para>
/// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks>
/// </summary>
/// <param name="sheetId"> the sheet Id </param>
/// <param name="include">elements to include in response</param>
/// <param name="paging">the paging</param>
/// <param name="level">compatibility level</param>
/// <returns> the list of Columns (note that an empty list will be returned if there is none) </returns>
/// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
/// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
/// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
/// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
/// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
/// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
public virtual PaginatedResult<Column> ListColumns(long sheetId, IEnumerable<ColumnInclusion> include, PaginationParameters paging, int? level)
{
StringBuilder path = new StringBuilder("sheets/" + sheetId + "/columns");
IDictionary<string, string> parameters = new Dictionary<string, string>();
if (paging != null)
{
parameters = paging.toDictionary();
} if (include != null)
}
if (include != null)
{
parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
}
if (level != null)
{
parameters.Add("level", level.ToString());
}
return this.ListResourcesWithWrapper<Column>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/columns", parameters));
}

Expand Down
2 changes: 1 addition & 1 deletion main/Smartsheet/Api/Models/Cell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public CellLink LinkInFromCell
/// An array of CellLink objects. Zero or more outbound links from this cell to cells in other sheets
/// whose values mirror this cell's value.
/// </summary>
private IList<CellLink> LinksOutToCells
public IList<CellLink> LinksOutToCells
{
get { return linksOutToCells; }
set { linksOutToCells = value; }
Expand Down
6 changes: 5 additions & 1 deletion main/Smartsheet/Api/Models/ColumnType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public enum ColumnType

/// <summary>
/// Represents the MULTI_CONTACT_LIST (multi-assign) column type. </summary>
MULTI_CONTACT_LIST
MULTI_CONTACT_LIST,

/// <summary>
/// Represents the MULTI_PICKLIST (multi-select picklist) column type. </summary>
MULTI_PICKLIST
}

}
53 changes: 53 additions & 0 deletions main/Smartsheet/Api/Models/MultiPicklistObjectValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2018 SmartsheetClient
// %%
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// %[license]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Smartsheet.Api.Models
{
public class MultiPicklistObjectValue : ObjectValue
{
public MultiPicklistObjectValue(IList<string> values)
{
this.values = values;
}

/// <summary>
/// the list of selected options
/// </summary>
private IList<string> values;

public ObjectValueType ObjectType
{
get { return ObjectValueType.MULTI_PICKLIST; }
}

/// <summary>
/// Gets the array of Contact objects
/// </summary>
public IList<string> Values
{
get { return values; }
set { values = value; }
}
}
}

1 change: 1 addition & 0 deletions main/Smartsheet/Api/Models/ObjectValueType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum ObjectValueType
DURATION,
PREDECESSOR_LIST,
MULTI_CONTACT,
MULTI_PICKLIST,
NUMBER,
BOOLEAN,
STRING,
Expand Down
18 changes: 18 additions & 0 deletions main/Smartsheet/Api/SheetColumnResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ public interface SheetColumnResources
/// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
PaginatedResult<Column> ListColumns(long sheetId, IEnumerable<ColumnInclusion> include, PaginationParameters paging);

/// <summary>
/// <para>Gets a list of all Columns belonging to the Sheet specified in the URL.</para>
/// <para>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/columns</para>
/// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks>
/// </summary>
/// <param name="sheetId"> the sheet Id </param>
/// <param name="include">elements to include in response</param>
/// <param name="paging">the paging</param>
/// <param name="level">compatibility level</param>
/// <returns> the list of Columns (note that an empty list will be returned if there is none) </returns>
/// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
/// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
/// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
/// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
/// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
/// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
PaginatedResult<Column> ListColumns(long sheetId, IEnumerable<ColumnInclusion> include, PaginationParameters paging, int? level);

/// <summary>
/// <para>Inserts one or more columns into the Sheet specified in the URL.</para>
///
Expand Down

0 comments on commit 1ec2037

Please sign in to comment.