Skip to content

Commit a40d4f4

Browse files
committed
changed ColumnValueForUpdates to internal and instead Utils.convertColumn ensures correct properties are set, fixes #1
also allowed changing DropdownValue columns by dropdown item IDs
1 parent c846579 commit a40d4f4

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

MondayApi/Schema/Models/ColumnValues/BoardRelationValue.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public class BoardRelationValue : IMirroredValue, IColumnValue {
2020
public object Value { get; set; }
2121
}
2222

23-
[GraphQlObjectType("BoardRelationValue__unused")]
24-
public class BoardRelationValueForUpdate : BoardRelationValue {
23+
internal class BoardRelationValueForUpdate { // https://developer.monday.com/api-reference/reference/connect#json
2524
[JsonProperty("item_ids")]
2625
public ICollection<string> ItemIDs { get; set; }
2726
}

MondayApi/Schema/Models/ColumnValues/CheckboxValue.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class CheckboxValue : IMirroredValue, IColumnValue {
1414
public object Value { get; set; }
1515
}
1616

17-
internal class CheckboxValueForUpdate {
18-
public string Checked { get; set; } // see https://developer.monday.com/api-reference/docs/checkbox#json
17+
internal class CheckboxValueForUpdate { // https://developer.monday.com/api-reference/reference/checkbox#json
18+
public string Checked { get; set; }
1919
}
2020
}

MondayApi/Schema/Models/ColumnValues/DropdownValue.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class DropdownValue : IMirroredValue, IColumnValue {
1111
public ICollection<DropdownValueOption> Values { get; set; }
1212
}
1313

14-
[GraphQlObjectType("DropdownValue__unused")]
15-
public class DropdownValueForUpdate : DropdownValue { // see https://developer.monday.com/api-reference/docs/dropdown#json
14+
internal class DropdownValueForUpdate { // https://developer.monday.com/api-reference/reference/dropdown#json
15+
public ICollection<string> IDs { get; set; }
1616
public ICollection<string> Labels { get; set; }
1717
}
1818
}

MondayApi/Schema/Models/ColumnValues/PeopleValue.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public class PeopleValue : IMirroredValue, IColumnValue {
1616
public object Value { get; set; }
1717
}
1818

19-
internal class PeopleValueForUpdate {
20-
[JsonProperty("personsAndTeams")] // see https://developer.monday.com/api-reference/docs/people#json
19+
internal class PeopleValueForUpdate { // https://developer.monday.com/api-reference/reference/people#json
20+
[JsonProperty("personsAndTeams")]
2121
public ICollection<PeopleEntity> PersonsAndTeams { get; set; }
2222
}
2323
}

MondayApi/Schema/Models/ColumnValues/PhoneValue.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public class PhoneValue : IMirroredValue, IColumnValue {
1616
public object Value { get; set; }
1717
}
1818

19-
[GraphQlObjectType("PhoneValue__unused")]
20-
public class PhoneValueForUpdate : PhoneValue {
21-
[JsonProperty("countryShortName")] // see https://developer.monday.com/api-reference/docs/phone#json
22-
public new string CountryShortName { get; set; }
19+
internal class PhoneValueForUpdate { // https://developer.monday.com/api-reference/reference/phone#json
20+
public string Phone { get; set; }
21+
[JsonProperty("countryShortName")]
22+
public string CountryShortName { get; set; }
2323
}
2424
}

MondayApi/Utils/Utils.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,19 @@ private static object convertColumn(IColumnValue column) {
3636
PersonsAndTeams = pv.PersonsAndTeams,
3737
};
3838
case BoardRelationValue bv:
39-
if (bv is BoardRelationValueForUpdate)
40-
return column;
4139
return new BoardRelationValueForUpdate() {
4240
ItemIDs = bv.LinkedItemIDs,
4341
};
42+
case PhoneValue pv:
43+
return new PhoneValueForUpdate() {
44+
Phone = pv.Phone,
45+
CountryShortName = pv.CountryShortName?.ToUpperInvariant(),
46+
};
47+
case DropdownValue dv:
48+
return new DropdownValueForUpdate() {
49+
IDs = dv.Values.Select(v => v.ID).ToList(),
50+
Labels = dv.Values.Select(v => v.Label).ToList(),
51+
};
4452
case CheckboxValue cv:
4553
return cv.Checked.HasValue && cv.Checked.Value
4654
? new CheckboxValueForUpdate() { Checked = "true" }

0 commit comments

Comments
 (0)