| All Verbs | /api/slimcontacts |
|---|
import Foundation
import ServiceStack
/**
* Get contacts connected to the current contact or licensee (if managing licensee contacts) by criteria, returning minimal number of columns
*/
// @Api(Description="Get contacts connected to the current contact or licensee (if managing licensee contacts) by criteria, returning minimal number of columns")
public class GetSlimContacts : PagedModel
{
/**
* Specific search text to search for, e.g. Contact Name, Employment Details etc.
*/
// @ApiMember(DataType="string", Description="Specific search text to search for, e.g. Contact Name, Employment Details etc.", Name="SearchText")
public var searchText:String
/**
* Contact Types to search for, i.e. People and/or Organisations
*/
// @ApiMember(DataType="List<Guid>", Description="Contact Types to search for, i.e. People and/or Organisations", IsRequired=true, Name="ContactTypes")
public var contactTypes:[String] = []
/**
* Contact statuses to search for, i.e. Real and/or Virtual
*/
// @ApiMember(DataType="List<Guid>", Description="Contact statuses to search for, i.e. Real and/or Virtual", IsRequired=true, Name="Statuses")
public var statuses:[String] = []
/**
* Include contacts previously connected to the contact but now removed.
*/
// @ApiMember(DataType="bool", Description="Include contacts previously connected to the contact but now removed.", Name="IncludeRemoved")
public var includeRemoved:Bool
/**
* Return all contacts matching criteria, or paged results?
*/
// @ApiMember(Description="Return all contacts matching criteria, or paged results?", Name="IsPagedMode")
public var isPagedMode:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case searchText
case contactTypes
case statuses
case includeRemoved
case isPagedMode
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
searchText = try container.decodeIfPresent(String.self, forKey: .searchText)
contactTypes = try container.decodeIfPresent([String].self, forKey: .contactTypes) ?? []
statuses = try container.decodeIfPresent([String].self, forKey: .statuses) ?? []
includeRemoved = try container.decodeIfPresent(Bool.self, forKey: .includeRemoved)
isPagedMode = try container.decodeIfPresent(Bool.self, forKey: .isPagedMode)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if searchText != nil { try container.encode(searchText, forKey: .searchText) }
if contactTypes.count > 0 { try container.encode(contactTypes, forKey: .contactTypes) }
if statuses.count > 0 { try container.encode(statuses, forKey: .statuses) }
if includeRemoved != nil { try container.encode(includeRemoved, forKey: .includeRemoved) }
if isPagedMode != nil { try container.encode(isPagedMode, forKey: .isPagedMode) }
}
}
public class PagedModel : Codable
{
/**
* Page Number to retrieve
*/
// @ApiMember(DataType="int", Description="Page Number to retrieve", Name="PageNumber")
public var pageNumber:Int
/**
* Number of records to retrieve
*/
// @ApiMember(DataType="int", Description="Number of records to retrieve", Name="PageSize")
public var pageSize:Int
/**
* Index of field to sort results by
*/
// @ApiMember(DataType="int", Description="Index of field to sort results by", Name="SortIndex")
public var sortIndex:Int
/**
* Sort Order - Ascending or Descending
*/
// @ApiMember(DataType="int", Description="Sort Order - Ascending or Descending", Name="SortOrder")
public var sortOrder:SortOrder
required public init(){}
}
public enum SortOrder : String, Codable
{
case Ascending
case Descending
}
// @ApiResponse(Description="Contacts connected to contact by criteria, returning minimal number of columns, and response status")
public class GetSlimContactsResponse : Codable
{
public var contacts:[ContactSummaryModel]
public var totalContacts:Int
public var responseStatus:ResponseStatus
required public init(){}
}
public class ContactSummaryModel : Codable
{
/**
* Contact linked to the profile
*/
// @ApiMember(DataType="Guid", Description="Contact linked to the profile", Name="ContactId")
public var contactId:String
/**
* Full name of the contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Full name of the contact linked to the profile", Name="ContactFullName")
public var contactFullName:String
/**
* Email Address of the contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Email Address of the contact linked to the profile", Name="EmailAddress")
public var emailAddress:String
/**
* Mobile Number of the contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Mobile Number of the contact linked to the profile", Name="MobileNumber")
public var mobileNumber:String
/**
* Primary Phone Number of the contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Primary Phone Number of the contact linked to the profile", Name="PhoneNumber")
public var phoneNumber:String
/**
* Type of contact (person, organisation etc.) linked to the profile
*/
// @ApiMember(DataType="string", Description="Type of contact (person, organisation etc.) linked to the profile", Name="ContactTypeId")
public var contactTypeId:String
/**
* Profile photo of contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Profile photo of contact linked to the profile", Name="ProfilePhotoUrl")
public var profilePhotoUrl:String
/**
* Thumbnail photo of contact linked to the profile
*/
// @ApiMember(DataType="string", Description="Thumbnail photo of contact linked to the profile", Name="ProfilePhotoThumbnailUrl")
public var profilePhotoThumbnailUrl:String
/**
* Profile description
*/
// @ApiMember(DataType="string", Description="Profile description", Name="Description")
public var Description:String
/**
* Employment Industry
*/
// @ApiMember(DataType="string", Description="Employment Industry", Name="EmploymentIndustry")
public var employmentIndustry:String
/**
* Employment Role
*/
// @ApiMember(DataType="string", Description="Employment Role", Name="EmploymentRole")
public var employmentRole:String
/**
* Areas of Work
*/
// @ApiMember(DataType="string", Description="Areas of Work", Name="EmploymentGeographicArea")
public var employmentGeographicArea:String
/**
* Timezone Name
*/
// @ApiMember(DataType="string", Description="Timezone Name", Name="TimezoneName", ParameterType="query")
public var timezoneName:String
/**
* The primary address of the contact
*/
// @ApiMember(DataType="string", Description="The primary address of the contact", Name="PrimaryAddress", ParameterType="query")
public var primaryAddress:String
/**
* Have all connections to the contact been removed?
*/
// @ApiMember(DataType="bool", Description="Have all connections to the contact been removed?", Name="IsRemovedContact")
public var isRemovedContact:Bool
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/slimcontacts HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"SearchText":"String","ContactTypes":["00000000-0000-0000-0000-000000000000"],"Statuses":["00000000-0000-0000-0000-000000000000"],"IncludeRemoved":false,"IsPagedMode":false,"PageNumber":0,"PageSize":0,"SortIndex":0,"SortOrder":"Ascending"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Contacts":[{"ContactId":"00000000-0000-0000-0000-000000000000","ContactFullName":"String","EmailAddress":"String","MobileNumber":"String","PhoneNumber":"String","ContactTypeId":"00000000-0000-0000-0000-000000000000","ProfilePhotoUrl":"String","ProfilePhotoThumbnailUrl":"String","Description":"String","EmploymentIndustry":"String","EmploymentRole":"String","EmploymentGeographicArea":"String","TimezoneName":"String","PrimaryAddress":"String","IsRemovedContact":false}],"TotalContacts":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}