using System; using System.Collections.Generic; using System.Text; namespace AvaskTest2.Shared.Models.Cdiscount { // base requests and responses public class CdiscountAuthCred { public string username { get; set; } public string password { get; set; } public string sellerId { get; set; } } public class CdiscountAuthPost //### { public string code { get; set; } // single use code public string client_id { get; set; } public string client_secret { get; set; } } public class CdiscountAuthReturn //### { public string access_token { get; set; } public int expires_in { get; set; } // access-token, 4 hours (14400) public string refresh_token { get; set; } public int refresh_token_expires_in { get; set; } // 18 months (47304000) public string scope { get; set; } public string token_type { get; set; } // 'User Access Token' or error message } public class CdiscountAuthCallbackGet //### { public string code { get; set; } // single use code public string state { get; set; } // our magic number } // required requests and responses public class CdiscountAuthCredentialsRequest : ClientRequest { public CdiscountAuthCredentialsRequest(User user, string clientId, CdiscountAuthCred userCred, string requestId = null, DateTime? timestamp = null) : base(user, clientId, requestId, timestamp) => UserCred = userCred; public CdiscountAuthCred UserCred { get; set; } } public class CdiscountAuthCredentialsResponse : RequestResponse { public CdiscountAuthCredentialsResponse( CdiscountAuthCredentialsRequest request, CdiscountAuthReturn authReturn, Exception exception = null, DateTime? timestamp = null) : base(request, exception, timestamp) => AuthReturn = authReturn; public CdiscountAuthReturn AuthReturn { get; set; } } public class CdiscountAuthGetUrlRequest : ClientRequest { public CdiscountAuthGetUrlRequest(User user, string clientId, string sellId, string requestId = null, DateTime? timestamp = null) : base(user, clientId, requestId, timestamp) => SellerId = sellId; public string SellerId { get; set; } } public class CdiscountAuthGetUrlResponse : RequestResponse { public CdiscountAuthGetUrlResponse( CdiscountAuthGetUrlRequest request, string authorisationUrl, Exception exception = null, DateTime? timestamp = null) : base(request, exception, timestamp) => AuthorisationUrl = authorisationUrl; public string AuthorisationUrl { get; set; } } public class CdiscountAuthCallbackRequest : ClientRequest { public CdiscountAuthCallbackRequest( User user, string clientId, CdiscountAuthCallbackGet authCallbackGet = null, string requestId = null, DateTime? timestamp = null) : base(user, clientId, requestId, timestamp) => this.AuthCallbackGet = authCallbackGet; public CdiscountAuthCallbackGet AuthCallbackGet { get; set; } } public class CdiscountAuthCallbackResponse : RequestResponse { public CdiscountAuthCallbackResponse( CdiscountAuthCallbackRequest request, CdiscountAuthReturn authReturn, Exception exception = null, DateTime? timestamp = null) : base(request, exception, timestamp) => this.AuthReturn = authReturn; public CdiscountAuthReturn AuthReturn { get; set; } } // common data-sets }