GET | /sales/members/{MemberId}/package-eligibility | Find out is a user is eligible to purchase a certain package. |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ClubReady.Web.Api.Sales.Model;
using ClubReady.Core.Api.Models;
using ClubReady.Web.Api;
using ClubReady.Core.Sales.Models;
namespace ClubReady.Core.Api.Models
{
public partial class ApiDtoBase
{
public virtual string ApiKey { get; set; }
public virtual int? StoreId { get; set; }
public virtual int? ChainId { get; set; }
}
public partial class ApiResponseBase
{
public virtual bool Success { get; set; }
public virtual string Message { get; set; }
}
public partial class PackageEligibilityRequestDto
: ApiDtoBase
{
public virtual int PackageId { get; set; }
public virtual int MemberId { get; set; }
}
public partial class PackageEligibilityResponseDto
: ApiResponseBase
{
public virtual PackageEligibility EligibilityInfo { get; set; }
}
}
namespace ClubReady.Core.Sales.Models
{
public partial class PackageEligibility
{
public PackageEligibility()
{
Eligibility = new List<PackageEligibilityItem>{};
}
public virtual bool IsEligible { get; set; }
public virtual List<PackageEligibilityItem> Eligibility { get; set; }
}
public partial class PackageEligibilityItem
{
public virtual string Name { get; set; }
public virtual string Value { get; set; }
public virtual bool IsEligible { get; set; }
public virtual string Message { get; set; }
}
}
namespace ClubReady.Web.Api
{
public enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
}
namespace ClubReady.Web.Api.Sales.Model
{
public partial class PackageEligibilityRequest
: PackageEligibilityRequestDto, IRestrictedApiRequest
{
///<summary>
///Api Key - grants access to resources
///</summary>
[ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")]
public virtual string ApiKey { get; set; }
///<summary>
///Store ID # member belongs to
///</summary>
[ApiMember(DataType="integer", Description="Store ID # member belongs to", IsRequired=true, Name="StoreId", ParameterType="query")]
public virtual int? StoreId { get; set; }
///<summary>
///ID of the member to lookup
///</summary>
[ApiMember(DataType="integer", Description="ID of the member to lookup", IsRequired=true, Name="MemberId", ParameterType="path")]
public virtual int MemberId { get; set; }
///<summary>
///ID of the package to check
///</summary>
[ApiMember(DataType="integer", Description="ID of the package to check", IsRequired=true, Name="PackageId", ParameterType="query")]
public virtual int PackageId { get; set; }
public virtual int? RestrictedId { get; set; }
public virtual RestrictedResourceType RestrictedResourceType { get; set; }
}
public partial class PackageEligibilityResponse
: PackageEligibilityResponseDto
{
public virtual PackageEligibility EligibilityInfo { get; set; }
}
}
C# PackageEligibilityRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /sales/members/{MemberId}/package-eligibility HTTP/1.1 Host: clubready.com Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"EligibilityInfo":{"IsEligible":false,"Eligibility":[{"Name":"String","Value":"String","IsEligible":false,"Message":"String"}]},"Success":false,"Message":"String"}