示例#1
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);
        }
示例#2
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);
        }