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

Commit

Permalink
Fix for Issue #119 - Model Profile Image as different object from Image
Browse files Browse the repository at this point in the history
  • Loading branch information
abryan-smartsheet committed Jul 28, 2020
1 parent 89ae53f commit 599235b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
5 changes: 5 additions & 0 deletions IntegrationTestSDK/UserResourcesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public void AddProfileImage()
{
UserProfile me = smartsheet.UserResources.GetCurrentUser();
smartsheet.UserResources.AddProfileImage(me.Id.Value, "../../../../../IntegrationTestSDK/curly.jpg", "image/jpeg");
me = smartsheet.UserResources.GetCurrentUser();
Assert.IsNotNull(me.ProfileImage.ImageId);
const int squareProfileImageSize = 1050;
Assert.AreEqual(squareProfileImageSize, me.ProfileImage.Width);
Assert.AreEqual(squareProfileImageSize, me.ProfileImage.Height);
}
}
}
69 changes: 69 additions & 0 deletions main/Smartsheet/Api/Models/ProfileImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2020 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;

namespace Smartsheet.Api.Models
{
/// <summary>
/// Represents the Image object. </summary>
/// <seealso href="https://smartsheet-platform.github.io/api-docs/#profileimage-object">ProfileImage Object Help</seealso>
public class ProfileImage
{
/// <summary>
/// Image ID</summary>
private string imageId;

/// <summary>
/// Original height (in pixels) of the image. </summary>
private long? height;

/// <summary>
/// Original width (in pixels) of the image. </summary>
private long? width;

/// <summary>
/// Get Image Id.
/// </summary>
/// <returns> the Id </returns>
public string ImageId
{
get { return imageId; }
set { imageId = value; }
}

/// <summary>
/// Get the Height (in pixels) of the image.
/// </summary>
public long? Height
{
get { return height; }
set { height = value; }
}

/// <summary>
/// Get the Width (in pixels) of the image.
/// </summary>
public long? Width
{
get { return width; }
set { width = value; }
}
}
}
4 changes: 2 additions & 2 deletions main/Smartsheet/Api/Models/UserModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public abstract class UserModel : IdentifiableModel
/// <summary>
/// Link to the user's profile image
/// </summary>
private Image profileImage;
private ProfileImage profileImage;

/// <summary>
/// Flag indicating whether the user is a resource viewer (can access resource views)
Expand Down Expand Up @@ -236,7 +236,7 @@ public string MobilePhone
/// <summary>
/// Gets a link to the user's profile image
/// </summary>
public Image ProfileImage
public ProfileImage ProfileImage
{
get { return profileImage; }
set { profileImage = value; }
Expand Down

0 comments on commit 599235b

Please sign in to comment.