BokaMera.API.Host

<back to all web services

AdminIncentiveActionQuery

Requires Authentication
Requires the role:superadmin
The following routes are available for this service:
GET/superadmin/incentives/actionQuery incentive actions
import Foundation
import ServiceStack

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
public class AdminIncentiveActionQuery : QueryDb2<IncentiveAction, QueryResponse<IncentiveActionResponse>>
{
    public var id:Int?
    public var countryId:String

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

    private enum CodingKeys : String, CodingKey {
        case id
        case countryId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
    }
}

public class IncentiveAction : BaseModel
{
    public var id:Int
    public var Description:String
    public var actionType:IncentiveActionType
    public var page:String
    public var segment:String
    public var element:String
    public var licenseTypeId:Int?

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

    private enum CodingKeys : String, CodingKey {
        case id
        case Description
        case actionType
        case page
        case segment
        case element
        case licenseTypeId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        actionType = try container.decodeIfPresent(IncentiveActionType.self, forKey: .actionType)
        page = try container.decodeIfPresent(String.self, forKey: .page)
        segment = try container.decodeIfPresent(String.self, forKey: .segment)
        element = try container.decodeIfPresent(String.self, forKey: .element)
        licenseTypeId = try container.decodeIfPresent(Int.self, forKey: .licenseTypeId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if actionType != nil { try container.encode(actionType, forKey: .actionType) }
        if page != nil { try container.encode(page, forKey: .page) }
        if segment != nil { try container.encode(segment, forKey: .segment) }
        if element != nil { try container.encode(element, forKey: .element) }
        if licenseTypeId != nil { try container.encode(licenseTypeId, forKey: .licenseTypeId) }
    }
}

public class BaseModel : Codable
{
    required public init(){}
}

public enum IncentiveActionType : Int, Codable
{
    case Upgrade = 1
    case AddOn = 2
    case Information = 3
}

public class AccessKeyTypeResponse : Codable
{
    public var id:Int
    public var keyType:String
    public var Description:String

    required public init(){}
}


Swift AdminIncentiveActionQuery 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 /superadmin/incentives/action HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Offset: 0,
	Total: 0,
	Results: 
	[
		{
			Offset: 0,
			Total: 0,
			Results: 
			[
				{
					Id: 0,
					Description: String,
					ActionType: Upgrade,
					Page: String,
					Segment: String,
					Element: String,
					LicenseTypeId: 0,
					SuggestedLicenseToUpgrade: 
					{
						Id: 0,
						Name: String,
						Description: String,
						IsExtraLicenseOption: False,
						PeriodOfNoticeDays: 0,
						Items: 
						[
							{
								Id: 0,
								Name: String,
								AllowedItems: 0
							}
						],
						Prices: 
						[
							{
								Country: 
								{
									CurrencyId: String,
									CurrencyInfo: 
									{
										Name: String,
										CurrencySign: String,
										Active: False,
										ModifiedDate: 0001-01-01T00:00:00.0000000+00:00,
										Id: String
									},
									Name: String,
									Culture: String,
									TimeZone: String,
									ModifiedDate: 0001-01-01T00:00:00.0000000+00:00,
									Id: String
								},
								MonthlyPayment: True,
								LicenseTypeId: 0,
								CountryId: String,
								Price: 0,
								ModifiedDate: 0001-01-01T00:00:00.0000000+00:00
							}
						]
					}
				}
			],
			Meta: 
			{
				String: String
			},
			ResponseStatus: 
			{
				ErrorCode: String,
				Message: String,
				StackTrace: String,
				Errors: 
				[
					{
						ErrorCode: String,
						FieldName: String,
						Message: String,
						Meta: 
						{
							String: String
						}
					}
				],
				Meta: 
				{
					String: String
				}
			}
		}
	],
	Meta: 
	{
		String: String
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}