Cochrane+ App API

<back to all web services

GetDashboardInfo

Requires Authentication
The following routes are available for this service:
GET/dashboard/info
import Foundation
import ServiceStack

public class GetDashboardInfo : ApiServiceRequest
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class ApiServiceRequest : IServiceRequest, IHasApiKey, IHasDeviceInfo, Codable
{
    /**
    * The API Key required for authentication
    */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    public var apiKey:String

    /**
    * Latitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Latitude of the user making this request")
    public var latitude:Double

    /**
    * Longitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Longitude of the user making this request")
    public var longitude:Double

    required public init(){}
}

public class GetDashboardInfoResponse : ApiServiceResponse
{
    public var unreadNotificationCount:Int
    public var nextMeetingDate:String
    public var totalMeetingsToday:Int
    public var outstandingRatingsCount:Int
    public var usersAverageRating:Double
    public var hasSharedRatings:Bool
    public var isSalesPerson:Bool
    public var usersRatingTotalVotes:Int
    public var usersRatingPosition:Int
    public var teamIds:[Int] = []
    public var nextMeeting:MeetingData
    public var attendanceEventType:AttendanceEventType
    public var outstandingDebriefsToReviewCount:Int
    public var outstandingTemplateApprovalsCount:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case unreadNotificationCount
        case nextMeetingDate
        case totalMeetingsToday
        case outstandingRatingsCount
        case usersAverageRating
        case hasSharedRatings
        case isSalesPerson
        case usersRatingTotalVotes
        case usersRatingPosition
        case teamIds
        case nextMeeting
        case attendanceEventType
        case outstandingDebriefsToReviewCount
        case outstandingTemplateApprovalsCount
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        unreadNotificationCount = try container.decodeIfPresent(Int.self, forKey: .unreadNotificationCount)
        nextMeetingDate = try container.decodeIfPresent(String.self, forKey: .nextMeetingDate)
        totalMeetingsToday = try container.decodeIfPresent(Int.self, forKey: .totalMeetingsToday)
        outstandingRatingsCount = try container.decodeIfPresent(Int.self, forKey: .outstandingRatingsCount)
        usersAverageRating = try container.decodeIfPresent(Double.self, forKey: .usersAverageRating)
        hasSharedRatings = try container.decodeIfPresent(Bool.self, forKey: .hasSharedRatings)
        isSalesPerson = try container.decodeIfPresent(Bool.self, forKey: .isSalesPerson)
        usersRatingTotalVotes = try container.decodeIfPresent(Int.self, forKey: .usersRatingTotalVotes)
        usersRatingPosition = try container.decodeIfPresent(Int.self, forKey: .usersRatingPosition)
        teamIds = try container.decodeIfPresent([Int].self, forKey: .teamIds) ?? []
        nextMeeting = try container.decodeIfPresent(MeetingData.self, forKey: .nextMeeting)
        attendanceEventType = try container.decodeIfPresent(AttendanceEventType.self, forKey: .attendanceEventType)
        outstandingDebriefsToReviewCount = try container.decodeIfPresent(Int.self, forKey: .outstandingDebriefsToReviewCount)
        outstandingTemplateApprovalsCount = try container.decodeIfPresent(Int.self, forKey: .outstandingTemplateApprovalsCount)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if unreadNotificationCount != nil { try container.encode(unreadNotificationCount, forKey: .unreadNotificationCount) }
        if nextMeetingDate != nil { try container.encode(nextMeetingDate, forKey: .nextMeetingDate) }
        if totalMeetingsToday != nil { try container.encode(totalMeetingsToday, forKey: .totalMeetingsToday) }
        if outstandingRatingsCount != nil { try container.encode(outstandingRatingsCount, forKey: .outstandingRatingsCount) }
        if usersAverageRating != nil { try container.encode(usersAverageRating, forKey: .usersAverageRating) }
        if hasSharedRatings != nil { try container.encode(hasSharedRatings, forKey: .hasSharedRatings) }
        if isSalesPerson != nil { try container.encode(isSalesPerson, forKey: .isSalesPerson) }
        if usersRatingTotalVotes != nil { try container.encode(usersRatingTotalVotes, forKey: .usersRatingTotalVotes) }
        if usersRatingPosition != nil { try container.encode(usersRatingPosition, forKey: .usersRatingPosition) }
        if teamIds.count > 0 { try container.encode(teamIds, forKey: .teamIds) }
        if nextMeeting != nil { try container.encode(nextMeeting, forKey: .nextMeeting) }
        if attendanceEventType != nil { try container.encode(attendanceEventType, forKey: .attendanceEventType) }
        if outstandingDebriefsToReviewCount != nil { try container.encode(outstandingDebriefsToReviewCount, forKey: .outstandingDebriefsToReviewCount) }
        if outstandingTemplateApprovalsCount != nil { try container.encode(outstandingTemplateApprovalsCount, forKey: .outstandingTemplateApprovalsCount) }
    }
}

public class ApiServiceResponse : IServiceResponse, Codable
{
    public var Description:String
    public var heading:String
    public var wasSuccessful:Bool
    //modelState:Object ignored. Type could not be extended in Swift

    required public init(){}
}

public class MeetingData : Codable
{
    public var meetingId:Int
    public var startTime:String
    public var arrivalTime:String
    public var leftTime:String
    public var duration:String
    public var showTimeFields:Bool
    public var arrivalStatus:String
    public var email:String
    public var hasEmail:Bool
    public var contactName:String
    public var latitude:Double
    public var longitude:Double
    public var location:String
    public var address:String
    public var subject:String
    public var Description:String
    public var endTime:String
    public var company:String
    public var contactNumber:String
    public var hasContactNumber:Bool
    public var hasLocation:Bool
    public var setBy:String
    public var virtualOrInPerson:String

    required public init(){}
}

public enum AttendanceEventType : Int, Codable
{
    case ClockOut = 0
    case ClockIn = 1
    case StartLunch = 2
    case EndLunch = 3
    case StartBreak = 4
    case EndBreak = 5
}


Swift GetDashboardInfo DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /dashboard/info HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	unreadNotificationCount: 0,
	nextMeetingDate: String,
	totalMeetingsToday: 0,
	outstandingRatingsCount: 0,
	usersAverageRating: 0,
	hasSharedRatings: False,
	isSalesPerson: False,
	usersRatingTotalVotes: 0,
	usersRatingPosition: 0,
	teamIds: 
	[
		0
	],
	nextMeeting: 
	{
		meetingId: 0,
		startTime: String,
		arrivalTime: String,
		leftTime: String,
		duration: String,
		showTimeFields: False,
		arrivalStatus: String,
		email: String,
		hasEmail: True,
		contactName: String,
		latitude: 0,
		longitude: 0,
		location: String,
		address: String,
		subject: String,
		description: String,
		endTime: String,
		company: String,
		contactNumber: String,
		hasContactNumber: True,
		hasLocation: False,
		setBy: String,
		virtualOrInPerson: String
	},
	attendanceEventType: 0,
	outstandingDebriefsToReviewCount: 0,
	outstandingTemplateApprovalsCount: 0,
	description: String,
	heading: String,
	wasSuccessful: False,
	modelState: {}
}