public static WorkMarketApiInterface GetInstance()
 {
     if (apiInterface == null)
     {
         lock (thisLock)
         {
             if (apiInterface == null)
             {
                 apiInterface = new WorkMarketApiInterface();
             }
         }
     }
     return(apiInterface);
 }
Exemple #2
0
        public static async Task <ResponseCommon> CreateAssignment(Assignment assignmentModel)
        {
            AccessTokenHelper accessTokenHelper = new AccessTokenHelper();

            WorkMarketApiInterface workMarketApiInterface = WorkMarketApiInterface.GetInstance();

            workMarketApiInterface.AccessToken = await accessTokenHelper.GetToken();

            ResponseCommon responseCommon = await workMarketApiInterface.CreateAssignment(assignmentModel);

            //Handle error if access token is expired

            return(responseCommon);
        }
Exemple #3
0
        public async Task <string> GetToken()
        {
            if (string.IsNullOrWhiteSpace(accessToken))
            {
                WorkMarketApiInterface workMarketApiInterface = WorkMarketApiInterface.GetInstance();
                ResponseCommon         responseCommon         = await workMarketApiInterface.RequestAccessToken(Token, Secret);

                if (responseCommon != null && responseCommon.Response != null)
                {
                    accessToken = responseCommon.Response.AccessToken;
                }
            }

            return(accessToken);
        }