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); }
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); }