PcoServicesNeededPosition constructor
PcoServicesNeededPosition({})
Create a new PcoServicesNeededPosition object using this endpoint: https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/plans/$planId/needed_positions
NOTES:
- Creating an instance of a class this way does not save it on the server.
- Call
save()
on the object to save it to the server. - Only set the
id
field if you know what you are doing. Save operations will overwrite data when theid
is set. - Dummy data can be supplied for a required parameter, but if so,
.save()
should not be called on the object - FIELDS USED WHEN CREATING:
quantity
,timeId
,timePreferenceOptionId
- FIELDS USED WHEN UPDATING:
quantity
Implementation
factory PcoServicesNeededPosition(
{required String serviceTypeId,
required String planId,
String? id,
int? quantity,
String? teamPositionName,
String? scheduledTo,
String? timeId,
String? timePreferenceOptionId,
Map<String, List<PcoResource>>? withRelationships,
List<PcoResource>? withIncluded}) {
var obj = PcoServicesNeededPosition.empty();
obj._id = id;
obj._apiPathOverride =
'https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/plans/$planId/needed_positions';
if (quantity != null) obj._attributes['quantity'] = quantity;
if (teamPositionName != null)
obj._attributes['team_position_name'] = teamPositionName;
if (scheduledTo != null) obj._attributes['scheduled_to'] = scheduledTo;
if (timeId != null) obj._attributes['time_id'] = timeId;
if (timePreferenceOptionId != null)
obj._attributes['time_preference_option_id'] = timePreferenceOptionId;
if (withRelationships != null) {
for (var r in withRelationships.entries) {
obj._relationships[r.key] = r.value;
}
obj._hasManualRelationships = true;
}
if (withIncluded != null) {
obj._included.addAll(withIncluded);
obj._hasManualIncluded = true;
}
return obj;
}