Class BaseApi
Base class for any GET API call, or any API call response.
Inherited Members
Namespace: Appearition.API
Assembly: Appearition.SDK.dll
Syntax
[Serializable]
public abstract class BaseApi
Fields
View SourceErrors
Declaration
public string[] Errors
Field Value
Type | Description |
---|---|
System.String[] |
IsSuccess
Declaration
public bool IsSuccess
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
View SourceApiVersion
API Version used by this request. Default value is 1.
Declaration
public virtual int ApiVersion { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The AP i version. |
AuthenticationOverride
Override of the authentication type used for a specific API
Declaration
public virtual AuthenticationOverrideType AuthenticationOverride { get; }
Property Value
Type | Description |
---|---|
AuthenticationOverrideType | The type of the authentication override. |
AuthenticationTokenCustomKey
If the authentication override type is set to custom, this value will be used to access the UserProfile authentication token dictionary to fetch the desired value. If none existing, the anonymous token will most likely be used.
Declaration
public virtual string AuthenticationTokenCustomKey { get; }
Property Value
Type | Description |
---|---|
System.String |
BypassInternetCheck
Whether this API can bypass the internet connectivity check.
Declaration
public virtual bool BypassInternetCheck { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ChannelIdOverride
Whether or not this specific API requires a certain channel id. If null, will use the one in the Appearition Gate.
Declaration
public virtual int? ChannelIdOverride { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ExtraRequestUrlHeaders
Provides a template for additional headers that should be included in the API call.
Declaration
protected virtual Dictionary<string, string> ExtraRequestUrlHeaders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | The extra URL headers. |
ForcedEndPoint
Whether or not the given request is forced to go to a specific end point instead of the main one.
Declaration
public virtual string ForcedEndPoint { get; }
Property Value
Type | Description |
---|---|
System.String |
GetEmsCall
Returns the end point part corresponding to this request. Format: api/RequestCategory/RequestName.
Declaration
public virtual string GetEmsCall { get; }
Property Value
Type | Description |
---|---|
System.String | The get EMS call. |
IsBeingUsed
Determines whether this API request object is currently being used or is available. The purpose of this flag is for re-usability of API objects, marking whether this API object can be reused or not.
Declaration
public virtual bool IsBeingUsed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
JsonReplaceKvp
A dictionary of string to be replaced from one to another. This can be used especially if a key has a name which cannot be used, such as "params", but is required by the EMS.
Declaration
public virtual Dictionary<string, string> JsonReplaceKvp { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
OverrideAuthenticationHeader
Whether or not the authentication in the request header should be overrode. If overrode, include your own.
Declaration
public virtual bool OverrideAuthenticationHeader { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
RequiresTenant
Whether or not this request should have a tenant as part of the request URL. True by default.
Declaration
public virtual bool RequiresTenant { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ResponseSaveType
How the API should be saved locally for offline capability. In order for the file to be saved, make sure AppearitionConstant.enableApiResponseStorage is true. Lastly, if using a CUSTOM api storage type, override GetCustomOfflineJsonContent and UpdateCustomOfflineJsonContent.
Declaration
public virtual TypeOfApiStorage ResponseSaveType { get; }
Property Value
Type | Description |
---|---|
TypeOfApiStorage |
Methods
View SourceGetApiCall<T>(String, String, Int32, BaseRequestContent)
Returns the API call of a given class
Declaration
public static string GetApiCall<T>(string source, string tenantName = "", int id = -1, BaseRequestContent requestContent = null)
where T : BaseApi
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Source. |
System.String | tenantName | Tenant name. |
System.Int32 | id | Identifier. |
BaseRequestContent | requestContent | Request content. |
Returns
Type | Description |
---|---|
System.String | The API call. |
Type Parameters
Name | Description |
---|---|
T | The 1st type parameter. |
GetCustomOfflineJsonContent(Int32, Object, BaseRequestContent)
When the ResponseSaveType is set to Custom, override this method to return a valid json.
Declaration
public virtual string GetCustomOfflineJsonContent(int channelId, object postBodyIfAny, BaseRequestContent requestContentIfAny)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | channelId | |
System.Object | postBodyIfAny | |
BaseRequestContent | requestContentIfAny |
Returns
Type | Description |
---|---|
System.String |
GetJsonFileExtraParams(Object, BaseRequestContent)
Declaration
public virtual string GetJsonFileExtraParams(object postBodyIfAny, BaseRequestContent requestContentIfAny)
Parameters
Type | Name | Description |
---|---|---|
System.Object | postBodyIfAny | |
BaseRequestContent | requestContentIfAny |
Returns
Type | Description |
---|---|
System.String |
GetRequestExtraHeaders()
Access the API's additional request headers.
Declaration
public virtual Dictionary<string, string> GetRequestExtraHeaders()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
ResetToDefault<T>()
Must contain information on how to reset this object to default. This system is made so that
Declaration
public virtual void ResetToDefault<T>()
where T : BaseApi
Type Parameters
Name | Description |
---|---|
T |
UpdateCustomOfflineJsonContent(BaseApi, Int32, Object, BaseRequestContent)
When the ResponseSaveType is set to Custom, override this method to update the local JSOn using live data.
Declaration
public virtual void UpdateCustomOfflineJsonContent(BaseApi api, int channelId, object postBodyIfAny, BaseRequestContent requestContentIfAny)
Parameters
Type | Name | Description |
---|---|---|
BaseApi | api | |
System.Int32 | channelId | |
System.Object | postBodyIfAny | |
BaseRequestContent | requestContentIfAny |