import Foundation
import ServiceStack
/**
* Inserts or Updates a project details and its contact connections and addresses.
*/
// @Api(Description="Inserts or Updates a project details and its contact connections and addresses.")
public class SaveProject : ValidationErrorList, ISubscription
{
/**
* Guid representing the external systems datasource information.
*/
// @ApiMember(DataType="Guid", Description="Guid representing the external systems datasource information.", IsRequired=true, Name="SuiteDataSourceInstanceId", ParameterType="body")
public var suiteDataSourceInstanceId:String
/**
* The unique key that represents the project on the external system.
*/
// @ApiMember(DataType="string", Description="The unique key that represents the project on the external system.", IsRequired=true, Name="AlternateKey", ParameterType="body")
public var alternateKey:String
/**
* Guid of the project object within PSTPF. If ObjectId is known, the external system may pass this instead of the alternate key.
*/
// @ApiMember(DataType="Guid", Description="Guid of the project object within PSTPF. If ObjectId is known, the external system may pass this instead of the alternate key.", Name="ObjectId", ParameterType="body")
public var objectId:String
/**
* If set to true, the object will be updated/refreshed. If false, the hash representation of the Project model and its data will be compared with the current Project to determine if there are any changes to save.
*/
// @ApiMember(DataType="bool", Description="If set to true, the object will be updated/refreshed. If false, the hash representation of the Project model and its data will be compared with the current Project to determine if there are any changes to save.", Name="IgnoreHash")
public var ignoreHash:Bool
/**
* Object containing all details of the project to be inserted or updated.
*/
// @ApiMember(DataType="SubscriptionCommonProjectModel", Description="Object containing all details of the project to be inserted or updated.", IsRequired=true, Name="Project", ParameterType="body")
public var project:SubscriptionCommonProjectModel
public var licenseeId:String
public var sessionId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case suiteDataSourceInstanceId
case alternateKey
case objectId
case ignoreHash
case project
case licenseeId
case sessionId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
suiteDataSourceInstanceId = try container.decodeIfPresent(String.self, forKey: .suiteDataSourceInstanceId)
alternateKey = try container.decodeIfPresent(String.self, forKey: .alternateKey)
objectId = try container.decodeIfPresent(String.self, forKey: .objectId)
ignoreHash = try container.decodeIfPresent(Bool.self, forKey: .ignoreHash)
project = try container.decodeIfPresent(SubscriptionCommonProjectModel.self, forKey: .project)
licenseeId = try container.decodeIfPresent(String.self, forKey: .licenseeId)
sessionId = try container.decodeIfPresent(String.self, forKey: .sessionId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if suiteDataSourceInstanceId != nil { try container.encode(suiteDataSourceInstanceId, forKey: .suiteDataSourceInstanceId) }
if alternateKey != nil { try container.encode(alternateKey, forKey: .alternateKey) }
if objectId != nil { try container.encode(objectId, forKey: .objectId) }
if ignoreHash != nil { try container.encode(ignoreHash, forKey: .ignoreHash) }
if project != nil { try container.encode(project, forKey: .project) }
if licenseeId != nil { try container.encode(licenseeId, forKey: .licenseeId) }
if sessionId != nil { try container.encode(sessionId, forKey: .sessionId) }
}
}
public class ValidationErrorList : Codable
{
/**
* List of any validation/errors occuring during a method call
*/
// @ApiMember(DataType="List<RuleValidationResult>", Description="List of any validation/errors occuring during a method call", Name="ValidationErrors", ParameterType="body")
public var validationErrors:[RuleValidationResult]
required public init(){}
}
public class RuleValidationResult : Codable
{
/**
* Validation/Error message details
*/
// @ApiMember(DataType="Guid", Description="Validation/Error message details", Name="Message", ParameterType="body")
public var message:String
/**
* Summary/label of validation/error
*/
// @ApiMember(DataType="Guid", Description="Summary/label of validation/error", Name="Key", ParameterType="body")
public var key:String
/**
* Key/code representing validation/error
*/
// @ApiMember(DataType="Guid", Description="Key/code representing validation/error", Name="ErrorCode", ParameterType="body")
public var errorCode:String
required public init(){}
}
public class SubscriptionCommonProjectModel : Codable
{
/**
* A reference number used for identifying the project in the external system.
*/
// @ApiMember(DataType="string", Description="A reference number used for identifying the project in the external system.", Name="Reference", ParameterType="body")
public var reference:String
/**
* A name for the project.
*/
// @ApiMember(DataType="string", Description="A name for the project.", IsRequired=true, Name="Name", ParameterType="body")
public var name:String
/**
* A description for the project.
*/
// @ApiMember(DataType="string", Description="A description for the project.", IsRequired=true, Name="Description", ParameterType="body")
public var Description:String
/**
* A list of ProjectContact records that link contacts (and their role in the project) to the project.
*/
// @ApiMember(DataType="List<SubscriptionLinkContact>", Description="A list of ProjectContact records that link contacts (and their role in the project) to the project.", Name="ProjectContacts", ParameterType="body")
public var projectContacts:[SubscriptionLinkContact]
/**
* An address for the project.
*/
// @ApiMember(DataType="AddressModel", Description="An address for the project.", Name="ProjectAddress", ParameterType="body")
public var projectAddress:AddressModel
/**
* A link to the Customer Contact Group.
*/
// @ApiMember(DataType="SubscriptionObjectModel", Description="A link to the Customer Contact Group.", Name="CustomerContactGroup", ParameterType="body")
public var customerContactGroup:SubscriptionObjectModel
/**
* Project Group Name.
*/
// @ApiMember(DataType="string", Description="Project Group Name.", Name="GroupName", ParameterType="body")
public var groupName:String
/**
* Stage Name.
*/
// @ApiMember(DataType="string", Description="Stage Name.", Name="StageName", ParameterType="body")
public var stageName:String
/**
* Guid of the Media Object representing the projects primary image.
*/
// @ApiMember(Description="Guid of the Media Object representing the projects primary image.", ParameterType="query")
public var primaryProjectImageId:String
/**
* URL to the projects primary full image.
*/
// @ApiMember(DataType="string", Description="URL to the projects primary full image.", Name="PrimaryProjectPhotoUrl", ParameterType="body")
public var primaryProjectPhotoUrl:String
/**
* URL to the projects primary thumbnail image.
*/
// @ApiMember(DataType="string", Description="URL to the projects primary thumbnail image.", Name="PrimaryProjectThumbnailUrl", ParameterType="body")
public var primaryProjectThumbnailUrl:String
/**
* Image height of the projects logo.
*/
// @ApiMember(DataType="int", Description="Image height of the projects logo.", Name="PrimaryProjectPhotoHeight", ParameterType="body")
public var primaryProjectPhotoHeight:Int
/**
* Image height of the projects logo.
*/
// @ApiMember(DataType="int", Description="Image height of the projects logo.", Name="PrimaryProjectPhotoWidth", ParameterType="body")
public var primaryProjectPhotoWidth:Int
/**
* Dynamically linked content.
*/
// @ApiMember(DataType="string", Description="Dynamically linked content.", Name="DynamicContent", ParameterType="body")
public var dynamicContent:String
/**
* If this is 'A' then a documentable ObjectConnection will be created. If this is 'D' then a documentable ObjectConnection will be removed if it exists. Any other value will be ignored.
*/
// @ApiMember(DataType="char", Description="If this is 'A' then a documentable ObjectConnection will be created. If this is 'D' then a documentable ObjectConnection will be removed if it exists. Any other value will be ignored.", Name="DocumentableObjectConnection", ParameterType="body")
public var documentableObjectConnection:String
/**
* Dimension values linked to the project.
*/
// @ApiMember(DataType="List<DimensionValueModel>", Description="Dimension values linked to the project.", Name="DimensionValues", ParameterType="body")
public var dimensionValues:[DimensionValueModel]
/**
* Dimension values linked to the project.
*/
// @ApiMember(DataType="List<Guid>", Description="Dimension values linked to the project.", Name="Calendars", ParameterType="body")
public var calendars:[String]
/**
* The Document Site ID.
*/
// @ApiMember(DataType="Guid", Description="The Document Site ID.", Name="DocumentSiteId", ParameterType="body")
public var documentSiteId:String?
public var objectSubscriptionId:String
public var objectHash:String
required public init(){}
}
public class SubscriptionLinkContact : Codable
{
/**
* Guid of the contact object within PSTPF.
*/
// @ApiMember(DataType="Guid", Description="Guid of the contact object within PSTPF.", Name="ContactId", ParameterType="body")
public var contactId:String
/**
* The unique key that represents the contact on the external system.
*/
// @ApiMember(DataType="string", Description="The unique key that represents the contact on the external system.", Name="ContactAlternateKey", ParameterType="body")
public var contactAlternateKey:String
/**
* Guid of the Role List Item object within PSTPF.
*/
// @ApiMember(DataType="Guid", Description="Guid of the Role List Item object within PSTPF.", Name="RoleId", ParameterType="body")
public var roleId:String
/**
* The unique key that represents the role type on the external system. Note: Use of this is not currently implemented
*/
// @ApiMember(DataType="string", Description="The unique key that represents the role type on the external system. Note: Use of this is not currently implemented", Name="RoleAlternateKey", ParameterType="body")
public var roleAlternateKey:String
required public init(){}
}
public class AddressModel : Codable
{
/**
* The distance between this project and another specified set of gps coordinates.
*/
// @ApiMember(DataType="double", Description="The distance between this project and another specified set of gps coordinates.", Name="DistanceAway", ParameterType="body")
public var distanceAway:Double
/**
* The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.
*/
// @ApiMember(DataType="Double?", Description="The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.", Name="Latitude", ParameterType="body")
public var latitude:Double
/**
* The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.
*/
// @ApiMember(DataType="Double?", Description="The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.", Name="Longitude", ParameterType="body")
public var longitude:Double
/**
* Address Format Id Guid - this will be determined by the service.
*/
// @ApiMember(DataType="Guid", Description="Address Format Id Guid - this will be determined by the service.", Name="AddressFormatId", ParameterType="body")
public var addressFormatId:String
/**
* Suburb Id Guid - this will attempt to be determined by the SuburbName, StateShortName and Postcode entered.
*/
// @ApiMember(DataType="Guid", Description="Suburb Id Guid - this will attempt to be determined by the SuburbName, StateShortName and Postcode entered.", Name="SuburbId", ParameterType="body")
public var suburbId:String
/**
* The suburb name.
*/
// @ApiMember(DataType="string", Description="The suburb name.", Name="SuburbName", ParameterType="body")
public var suburbName:String
/**
* The shortened State Name e.g Vic for Victoria.
*/
// @ApiMember(DataType="string", Description="The shortened State Name e.g Vic for Victoria.", Name="StateShortName", ParameterType="body")
public var stateShortName:String
/**
* The suburb postcode.
*/
// @ApiMember(DataType="string", Description="The suburb postcode.", Name="PostCode", ParameterType="body")
public var postCode:String
/**
* Country Id Guid - this will be determined by the CountrName or ISOCountryCode entered.
*/
// @ApiMember(DataType="Guid", Description="Country Id Guid - this will be determined by the CountrName or ISOCountryCode entered.", Name="CountryId", ParameterType="body")
public var countryId:String
/**
* the name of the country the address is within.
*/
// @ApiMember(DataType="string", Description="the name of the country the address is within.", Name="CountryName", ParameterType="body")
public var countryName:String
/**
* ISO Country Code.
*/
// @ApiMember(Description="ISO Country Code.", ParameterType="query")
public var isoCountryCode:String
/**
* The address Lot number.
*/
// @ApiMember(DataType="string", Description="The address Lot number.", Name="LotNumber", ParameterType="body")
public var lotNumber:String
/**
* The address Sub Unit number.
*/
// @ApiMember(DataType="string", Description="The address Sub Unit number.", Name="SubUnit", ParameterType="body")
public var subUnit:String
/**
* The address building number.
*/
// @ApiMember(DataType="string", Description="The address building number.", Name="BuildingNumber", ParameterType="body")
public var buildingNumber:String
/**
* The address street number.
*/
// @ApiMember(DataType="string", Description="The address street number.", Name="StreetNumber", ParameterType="body")
public var streetNumber:String
/**
* The address street name including street type.
*/
// @ApiMember(DataType="string", Description="The address street name including street type.", Name="StreetName", ParameterType="body")
public var streetName:String
/**
* A formatted address Line 1.
*/
// @ApiMember(DataType="string", Description="A formatted address Line 1.", Name="AddressLineOne", ParameterType="body")
public var addressLineOne:String
/**
* A formatted address Line 2.
*/
// @ApiMember(DataType="string", Description="A formatted address Line 2.", Name="AddressLineTwo", ParameterType="body")
public var addressLineTwo:String
/**
* The full address string.
*/
// @ApiMember(DataType="string", Description="The full address string.", Name="AddressFull", ParameterType="body")
public var addressFull:String
/**
* True if the address is a physical location.
*/
// @ApiMember(DataType="bool?", Description="True if the address is a physical location.", Name="IsPhysical", ParameterType="body")
public var isPhysical:Bool?
/**
* Notes about the address.
*/
// @ApiMember(DataType="string", Description="Notes about the address.", Name="Notes")
public var notes:String
/**
* If true, the address is eligible for having its coordinates calculated/updated.
*/
// @ApiMember(DataType="bool?", Description="If true, the address is eligible for having its coordinates calculated/updated.", Name="AutoMapCoordinates", ParameterType="body")
public var autoMapCoordinates:Bool?
/**
* Location Coordinates for the address.
*/
// @ApiMember(DataType="LocationCoordinates", Description="Location Coordinates for the address.", Name="LocationCoordinates", ParameterType="body")
public var locationCoordinates:LocationCoordinatesModel
required public init(){}
}
public class LocationCoordinatesModel : Codable
{
/**
* The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.
*/
// @ApiMember(Description="The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.", ParameterType="query")
public var latitude:Double
/**
* The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.
*/
// @ApiMember(Description="The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.", ParameterType="query")
public var longitude:Double
/**
* The altitude of an address - the altitude above sea level."
*/
// @ApiMember(Description="The altitude of an address - the altitude above sea level.\"", ParameterType="query")
public var altitude:Double?
/**
* Accuracy of the latitude and longitude.
*/
// @ApiMember(Description="Accuracy of the latitude and longitude.", ParameterType="query")
public var accuracy:Double?
/**
* Accurancy of the Altitude.
*/
// @ApiMember(Description="Accurancy of the Altitude.", ParameterType="query")
public var altitudeAccuracy:Double?
/**
* Direction you are heading.
*/
// @ApiMember(Description="Direction you are heading.", ParameterType="query")
public var heading:Double?
/**
* Speed you are going.
*/
// @ApiMember(Description="Speed you are going.", ParameterType="query")
public var speed:Double?
/**
* Speed your altitude is ascending/descending at.
*/
// @ApiMember(Description="Speed your altitude is ascending/descending at.", ParameterType="query")
public var verticalSpeed:Double?
required public init(){}
}
public class SubscriptionObjectModel : ISubscription, Codable
{
/**
* Guid representing the external systems datasource information.
*/
// @ApiMember(DataType="Guid", Description="Guid representing the external systems datasource information.", IsRequired=true, Name="SuiteDataSourceInstanceId", ParameterType="body")
public var suiteDataSourceInstanceId:String
/**
* The unique key that represents the object on the external system.
*/
// @ApiMember(DataType="string", Description="The unique key that represents the object on the external system.", Name="AlternateKey", ParameterType="body")
public var alternateKey:String
/**
* Guid of the object within PSTPF. If ObjectId is known, the external system may pass this instead of the alternate key.
*/
// @ApiMember(DataType="Guid", Description="Guid of the object within PSTPF. If ObjectId is known, the external system may pass this instead of the alternate key.", Name="ObjectId", ParameterType="body")
public var objectId:String
/**
* Guid of the RmsTableCtx within PSTPF. This is used if the alternate key is provided to identify the object to update.
*/
// @ApiMember(DataType="Guid", Description="Guid of the RmsTableCtx within PSTPF. This is used if the alternate key is provided to identify the object to update.", Name="RmsTableCtxId", ParameterType="body")
public var rmsTableCtxId:String
required public init(){}
}
public class DimensionValueModel : Codable
{
/**
* Id of the dimension value.
*/
// @ApiMember(DataType="Guid", Description="Id of the dimension value.", Name="DimensionValueId", ParameterType="body")
public var dimensionValueId:String
/**
* Dimension Id this value is for.
*/
// @ApiMember(Description="Dimension Id this value is for.", ParameterType="body")
public var dimensionId:String
/**
* Name of the dimension value.
*/
// @ApiMember(Description="Name of the dimension value.", ParameterType="body")
public var name:String
/**
* Description of the dimension value.
*/
// @ApiMember(Description="Description of the dimension value.", ParameterType="body")
public var Description:String
/**
* Short Name for the dimension value.
*/
// @ApiMember(Description="Short Name for the dimension value.", ParameterType="body")
public var shortName:String
/**
* Id of the colour associated.
*/
// @ApiMember(Description="Id of the colour associated.", ParameterType="body")
public var trafficLightId:String
/**
* Colour associated with the dimension value.
*/
// @ApiMember(Description="Colour associated with the dimension value.", ParameterType="body")
public var trafficLightColour:String
/**
* Id that links this dimension value to an object.
*/
// @ApiMember(Description="Id that links this dimension value to an object.", ParameterType="body")
public var objectConnectionId:String
/**
* Owner Id of the dimension value.
*/
// @ApiMember(Description="Owner Id of the dimension value.", ParameterType="body")
public var ownerContactId:String
/**
* Record status of the dimension value.
*/
// @ApiMember(Description="Record status of the dimension value.", ParameterType="body")
public var recordStatus:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /csv/reply/SaveProject HTTP/1.1
Host: production-eros-platform-apisubscription.azurewebsites.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"AlternateKey":"String","IgnoreHash":false,"Project":{"Reference":"String","Name":"String","Description":"String","ProjectContacts":[{"ContactAlternateKey":"String","RoleAlternateKey":"String"}],"ProjectAddress":{"DistanceAway":0,"Latitude":0,"Longitude":0,"SuburbName":"String","StateShortName":"String","PostCode":"String","CountryName":"String","ISOCountryCode":"String","LotNumber":"String","SubUnit":"String","BuildingNumber":"String","StreetNumber":"String","StreetName":"String","AddressLineOne":"String","AddressLineTwo":"String","AddressFull":"String","IsPhysical":false,"Notes":"String","AutoMapCoordinates":false,"LocationCoordinates":{"Latitude":0,"Longitude":0,"Altitude":0,"Accuracy":0,"AltitudeAccuracy":0,"Heading":0,"Speed":0,"VerticalSpeed":0}},"CustomerContactGroup":{"AlternateKey":"String"},"GroupName":"String","StageName":"String","PrimaryProjectPhotoUrl":"String","PrimaryProjectThumbnailUrl":"String","PrimaryProjectPhotoHeight":0,"PrimaryProjectPhotoWidth":0,"DynamicContent":"String","DocumentableObjectConnection":"\u0000","DimensionValues":[{"Name":"String","Description":"String","ShortName":"String","TrafficLightColour":"String","RecordStatus":"String"}],"Calendars":["00000000-0000-0000-0000-000000000000"],"DocumentSiteId":"00000000-0000-0000-0000-000000000000","ObjectHash":"String"},"ValidationErrors":[{"Message":"String","Key":"String","ErrorCode":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}