Skip to content

Commit

Permalink
fixed long id bug for all objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Kuffner committed Feb 19, 2020
1 parent 617327f commit d90d9a0
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/YammerShell/CmdLets/GetYmGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ protected override void ProcessRecord()
private YammerGroup GetYammerGroupFromJToken(JToken group)
{
var yammerGroup = new YammerGroup();
yammerGroup.Id = Convert.ToInt32(group["id"]);
yammerGroup.Id = Convert.ToInt64(group["id"]);
yammerGroup.Email = (group["email"] ?? string.Empty).ToString();
yammerGroup.FullName = group["full_name"].ToString();
yammerGroup.Name = group["name"].ToString();
yammerGroup.NetworkId = Convert.ToInt32(group["network_id"]);
yammerGroup.NetworkId = Convert.ToInt64(group["network_id"]);
yammerGroup.Description = (group["description"] ?? string.Empty).ToString();
yammerGroup.Privacy = group["privacy"].ToString();
yammerGroup.Url = (group["web_url"] ?? string.Empty).ToString();
yammerGroup.CreatedAt = (DateTime)(group["created_at"] ?? DateTime.MinValue);
yammerGroup.CreatorId = Convert.ToInt32(group["creator_id"] ?? -1);
yammerGroup.CreatorId = Convert.ToInt64(group["creator_id"] ?? -1);
yammerGroup.Members = Convert.ToInt32(group["stats"]["members"]);
return yammerGroup;
}
Expand Down
6 changes: 3 additions & 3 deletions src/YammerShell/CmdLets/GetYmNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class GetYmNetwork : PSCmdlet
Position = 0,
HelpMessage = "With this parameter set you request all networks the user has access to but filtered by id."
)]
public int? Id { get; set; }
public long? Id { get; set; }

protected override void ProcessRecord()
{
Expand All @@ -36,7 +36,7 @@ protected override void ProcessRecord()
var yammerNetworks = new List<YammerNetwork>();
foreach (var network in JArray.Parse(result))
{
var networkId = Convert.ToInt32(network["id"]);
var networkId = Convert.ToInt64(network["id"]);
if (!Id.HasValue || Id == networkId)
{
yammerNetworks.Add(GetYammerNetwork(network, networkId));
Expand All @@ -51,7 +51,7 @@ protected override void ProcessRecord()
}
}

private YammerNetwork GetYammerNetwork(JToken network, int id)
private YammerNetwork GetYammerNetwork(JToken network, long id)
{
var yammerNetwork = new YammerNetwork();
yammerNetwork.Id = id;
Expand Down
8 changes: 4 additions & 4 deletions src/YammerShell/CmdLets/GetYmUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GetYmUser : PSCmdlet
HelpMessage = "ID of a user",
ParameterSetName = "Id"
)]
public int? Id { get; set; }
public long? Id { get; set; }

[ValidateRange(1,1000)]
[Parameter(
Expand Down Expand Up @@ -174,7 +174,7 @@ private IEnumerable<YammerUser> GetYammerUsersInGroup(int? groupId)
return allYammerUsers;
}

public YammerUser GetYammerUser(int id)
public YammerUser GetYammerUser(long id)
{
var result = _request.Get(string.Format("{0}users/{1}.json", Properties.Resources.YammerApi, id));
var user = JObject.Parse(result);
Expand Down Expand Up @@ -249,7 +249,7 @@ public IEnumerable<YammerUser> GetYammerUsers()
private YammerUser GetYammerUser(JToken user)
{
var yammerUser = new YammerUser();
yammerUser.Id = Convert.ToInt32(GetToken(user, "id"));
yammerUser.Id = Convert.ToInt64(GetToken(user, "id"));
yammerUser.UserName = GetToken(user, "name");
yammerUser.FirstName = GetToken(user, "first_name");
yammerUser.LastName = GetToken(user, "last_name");
Expand All @@ -258,7 +258,7 @@ private YammerUser GetYammerUser(JToken user)
yammerUser.JobTitle = GetToken(user, "job_title");
yammerUser.Department = GetToken(user, "department");
yammerUser.Timezone = GetToken(user, "timezone");
yammerUser.NetworkId = Convert.ToInt32(GetToken(user, "network_id"));
yammerUser.NetworkId = Convert.ToInt64(GetToken(user, "network_id"));
yammerUser.NetworkName = GetToken(user, "network_name");
yammerUser.Url = GetToken(user, "web_url");
var activatedAt = user["activated_at"];
Expand Down
2 changes: 1 addition & 1 deletion src/YammerShell/CmdLets/NewYmGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override void ProcessRecord()
{
var response = _request.Post(requestUrl, string.Empty);
var newGroup = JObject.Parse(response);
WriteObject(Convert.ToInt32(newGroup["id"]));
WriteObject(Convert.ToInt64(newGroup["id"]));
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/YammerShell/CmdLets/NewYmMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected override void ProcessRecord()
var jObject = JObject.Parse(response);
var messages = JArray.Parse(jObject["messages"].ToString());
var id = messages[0]["id"];
WriteObject(Convert.ToInt32(id));
WriteObject(Convert.ToInt64(id));
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/YammerShell/CmdLets/NewYmUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected override void ProcessRecord()
var url = string.Format("{0}users.json?{1}{2}{3}{4}{5}{6}", Properties.Resources.YammerApi, Email, fullName, jobTitle, departmentName, location, workTelephone);
var response = _request.Post(url, string.Empty);
var newUser = JObject.Parse(response);
WriteObject(Convert.ToInt32(newUser["id"]));
WriteObject(Convert.ToInt64(newUser["id"]));
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/YammerShell/CmdLets/RemoveYmMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class RemoveYmMessage : PSCmdlet
Position = 0,
HelpMessage = "ID of the message to delete"
)]
public int Id { get; set; }
public long Id { get; set; }

protected override void ProcessRecord()
{
Expand Down
18 changes: 9 additions & 9 deletions src/YammerShell/CmdLets/SearchYmItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private YammerSearchResult GetYammerSearchResult(JObject response)
private YammerUser GetYammerUser(JToken user)
{
var yammerUser = new YammerUser();
yammerUser.Id = Convert.ToInt32(GetToken(user, "id"));
yammerUser.Id = Convert.ToInt64(GetToken(user, "id"));
yammerUser.UserName = GetToken(user, "name");
yammerUser.FirstName = GetToken(user, "first_name");
yammerUser.LastName = GetToken(user, "last_name");
Expand All @@ -122,7 +122,7 @@ private YammerUser GetYammerUser(JToken user)
yammerUser.JobTitle = GetToken(user, "job_title");
yammerUser.Department = GetToken(user, "department");
yammerUser.Timezone = GetToken(user, "timezone");
yammerUser.NetworkId = Convert.ToInt32(GetToken(user, "network_id"));
yammerUser.NetworkId = Convert.ToInt64(GetToken(user, "network_id"));
yammerUser.NetworkName = GetToken(user, "network_name");
yammerUser.Url = GetToken(user, "web_url");
var activatedAt = user["activated_at"];
Expand Down Expand Up @@ -152,8 +152,8 @@ private YammerFile GetYammerFile(JToken file)
{
var yammerFile = new YammerFile();

yammerFile.Id = Convert.ToInt32(file["id"]);
yammerFile.NetworkId = Convert.ToInt32(file["network_id"]);
yammerFile.Id = Convert.ToInt64(file["id"]);
yammerFile.NetworkId = Convert.ToInt64(file["network_id"]);
yammerFile.GroupId = file.Value<int?>("group_id");
yammerFile.OwnerId = file.Value<int?>("owner_id");
yammerFile.Url = file["web_url"].ToString();
Expand All @@ -169,26 +169,26 @@ private YammerFile GetYammerFile(JToken file)
private YammerTopic GetYammerTopic(JToken topic)
{
var yammerTopic = new YammerTopic();
yammerTopic.Id = Convert.ToInt32(topic["id"]);
yammerTopic.Id = Convert.ToInt64(topic["id"]);
yammerTopic.Name = topic["name"].ToString();
yammerTopic.NetworkId = Convert.ToInt32(topic["network_id"]);
yammerTopic.NetworkId = Convert.ToInt64(topic["network_id"]);
yammerTopic.Url = topic["web_url"].ToString();
return yammerTopic;
}

private YammerGroup GetYammerGroup(JToken group)
{
var yammerGroup = new YammerGroup();
yammerGroup.Id = Convert.ToInt32(group["id"]);
yammerGroup.Id = Convert.ToInt64(group["id"]);
yammerGroup.Email = group["email"].ToString();
yammerGroup.FullName = group["full_name"].ToString();
yammerGroup.Name = group["name"].ToString();
yammerGroup.NetworkId = Convert.ToInt32(group["network_id"]);
yammerGroup.NetworkId = Convert.ToInt64(group["network_id"]);
yammerGroup.Description = group["description"].ToString();
yammerGroup.Privacy = group["privacy"].ToString();
yammerGroup.Url = group["web_url"].ToString();
yammerGroup.CreatedAt = (DateTime)group["created_at"];
yammerGroup.CreatorId = Convert.ToInt32(group["creator_id"]);
yammerGroup.CreatorId = Convert.ToInt64(group["creator_id"]);
yammerGroup.Members = Convert.ToInt32(group["stats"]["members"]);
return yammerGroup;
}
Expand Down
4 changes: 2 additions & 2 deletions src/YammerShell/CmdLets/ShowYmRelationships.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ private YammerUser GetYammerUser(JToken user)
{
var yammerUser = new YammerUser();
yammerUser.UserName = GetToken(user, "name");
yammerUser.Id = Convert.ToInt32(GetToken(user, "id"));
yammerUser.Id = Convert.ToInt64(GetToken(user, "id"));
yammerUser.FirstName = GetToken(user, "first_name");
yammerUser.LastName = GetToken(user, "last_name");
yammerUser.FullName = GetToken(user, "full_name");
yammerUser.Email = GetToken(user, "email");
yammerUser.JobTitle = GetToken(user, "job_title");
yammerUser.Department = GetToken(user, "department");
yammerUser.Timezone = GetToken(user, "timezone");
yammerUser.NetworkId = Convert.ToInt32(GetToken(user, "network_id"));
yammerUser.NetworkId = Convert.ToInt64(GetToken(user, "network_id"));
yammerUser.NetworkName = GetToken(user, "network_name");
yammerUser.Url = GetToken(user, "web_url");
var activatedAt = user["activated_at"];
Expand Down
8 changes: 4 additions & 4 deletions src/YammerShell/YammerObjects/YammerFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace YammerShell.YammerObjects
{
public class YammerFile
{
public int Id { get; set; }
public int NetworkId { get; set; }
public int? GroupId { get; set; }
public int? OwnerId { get; set; }
public long Id { get; set; }
public long NetworkId { get; set; }
public long? GroupId { get; set; }
public long? OwnerId { get; set; }
public string Url { get; set; }
public string Name { get; set; }
public string Description { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions src/YammerShell/YammerObjects/YammerGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ namespace YammerShell.YammerObjects
{
public class YammerGroup
{
public int Id { get; set; }
public long Id { get; set; }
public string Email { get; set; }
public string FullName { get; set; }
public string Name { get; set; }
public int NetworkId { get; set; }
public long NetworkId { get; set; }
public string Description { get; set; }
public string Privacy { get; set; }
public string Url { get; set; }
public DateTime CreatedAt { get; set; }
public int CreatorId { get; set; }
public long CreatorId { get; set; }
public int Members { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/YammerShell/YammerObjects/YammerNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace YammerShell.YammerObjects
{
public class YammerNetwork
{
public int Id { get; set; }
public long Id { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string Url { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/YammerShell/YammerObjects/YammerTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
public class YammerTopic
{
public int Id { get; set; }
public int NetworkId { get; set; }
public long Id { get; set; }
public long NetworkId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
}
Expand Down
4 changes: 2 additions & 2 deletions src/YammerShell/YammerObjects/YammerUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace YammerShell.YammerObjects
{
public class YammerUser
{
public int Id { get; set; }
public long Id { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
Expand All @@ -14,7 +14,7 @@ public class YammerUser
public string JobTitle { get; set; }
public string Department { get; set; }
public string Timezone { get; set; }
public int NetworkId { get; set; }
public long NetworkId { get; set; }
public string NetworkName { get; set; }
public IEnumerable<string> PhoneNumbers { get; set; }
public DateTime ActivatedAt { get; set; }
Expand Down

0 comments on commit d90d9a0

Please sign in to comment.