Booster.Microservices

<back to all web services

ArticleImageRequest

The following routes are available for this service:
GET/warranty/v1/article/{referenceId}/image/{format*}
import Foundation
import ServiceStack

public class ArticleImageRequest : BaseRequest<ArticleImageResponse>
{
    public var referenceId:String
    public var format:String

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

    private enum CodingKeys : String, CodingKey {
        case referenceId
        case format
    }

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

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

public class BaseRequest<TResponse : Codable> : IRequest, Codable
{
    public var sid:String
    public var app:String
    public var _os:String
    public var _appVersion:String
    public var _searchMethod:String

    required public init(){}
}

public class ArticleImageResponse : Codable
{
    public var imageUrl:String

    required public init(){}
}


Swift ArticleImageRequest DTOs

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

HTTP + OTHER

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

GET /warranty/v1/article/{referenceId}/image/{format*} HTTP/1.1 
Host: qp-microservices-booster.richemont.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"imageUrl":"String"}