public GetTagsResponse GetTags(GetTagsRequest request) { var response = new GetTagsResponse(); try { if (request.Id <= 0) { response.Errors.Add("The Id value is 0 or less"); } else { response.Tags = _context.Tag.Where(x => x.Id == request.Id).Select(x => new Tag { Name = x.Name, Id = x.Id }).ToList(); return(response); } } catch (Exception msg) { response.Errors.Add(msg.Message); } response.Errors.Add("Something went wrong"); return(response); }
public async Task <IHttpActionResult> Get() { var request = new GetTagsRequest(); request.TenantUniqueId = Request.GetTenantUniqueId(); return(Ok(await _mediator.Send(request))); }
/// <summary> /// You can query for available tag keys and tag values for a specified period. You can /// search the tag values for an arbitrary string. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetTags service method.</param> /// /// <returns>The response from the GetTags service method, as returned by CostExplorer.</returns> /// <exception cref="Amazon.CostExplorer.Model.BillExpirationException"> /// The requested report expired. Update the date interval and try again. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.InvalidNextTokenException"> /// The pagination token is invalid. Try again without a pagination token. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.LimitExceededException"> /// You made too many calls in a short period of time. Try again later. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ce-2017-10-25/GetTags">REST API Reference for GetTags Operation</seealso> public virtual GetTagsResponse GetTags(GetTagsRequest request) { var marshaller = new GetTagsRequestMarshaller(); var unmarshaller = GetTagsResponseUnmarshaller.Instance; return Invoke<GetTagsRequest,GetTagsResponse>(request, marshaller, unmarshaller); }
internal virtual GetTagsResponse GetTags(GetTagsRequest request) { var marshaller = GetTagsRequestMarshaller.Instance; var unmarshaller = GetTagsResponseUnmarshaller.Instance; return(Invoke <GetTagsRequest, GetTagsResponse>(request, marshaller, unmarshaller)); }
public async Task <IActionResult> GetTagsAsync([FromBody] GetTagsRequest request) { CheckBodyParameter(request); var result = await new GetAllTags(callContext).RunAsync(new GetAllTags.Request(request.PageSize, request.PageNo, request.Filter)); return(Ok(new GetTagsViewModel(result))); }
public async Task <IActionResult> Index(GetTagsRequest request) { var tagPage = await _tagManager.GetAsync(request.ToQuery(PageSize), Cancel); var viewModel = new TagsViewModel(tagPage, request.Page); return(View(viewModel)); }
/// <summary> /// Initiates the asynchronous execution of the GetTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTags operation on AmazonCostExplorerClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetTags /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ce-2017-10-25/GetTags">REST API Reference for GetTags Operation</seealso> public virtual IAsyncResult BeginGetTags(GetTagsRequest request, AsyncCallback callback, object state) { var marshaller = new GetTagsRequestMarshaller(); var unmarshaller = GetTagsResponseUnmarshaller.Instance; return(BeginInvoke <GetTagsRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the GetTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTags operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/resource-groups-2017-11-27/GetTags">REST API Reference for GetTags Operation</seealso> public virtual Task <GetTagsResponse> GetTagsAsync(GetTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = GetTagsRequestMarshaller.Instance; var unmarshaller = GetTagsResponseUnmarshaller.Instance; return(InvokeAsync <GetTagsRequest, GetTagsResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the GetTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTags operation on AmazonCostExplorerClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetTags /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ce-2017-10-25/GetTags">REST API Reference for GetTags Operation</seealso> public virtual IAsyncResult BeginGetTags(GetTagsRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = GetTagsRequestMarshaller.Instance; options.ResponseUnmarshaller = GetTagsResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary> /// Queries for available tag keys and tag values for a specified period. You can search /// the tag values for an arbitrary string. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetTags service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the GetTags service method, as returned by CostExplorer.</returns> /// <exception cref="Amazon.CostExplorer.Model.BillExpirationException"> /// The requested report expired. Update the date interval and try again. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.DataUnavailableException"> /// The requested data is unavailable. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.InvalidNextTokenException"> /// The pagination token is invalid. Try again without a pagination token. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.LimitExceededException"> /// You made too many calls in a short period of time. Try again later. /// </exception> /// <exception cref="Amazon.CostExplorer.Model.RequestChangedException"> /// Your request parameters changed between pages. Try again with the old parameters or /// without a pagination token. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ce-2017-10-25/GetTags">REST API Reference for GetTags Operation</seealso> public virtual Task <GetTagsResponse> GetTagsAsync(GetTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetTagsRequestMarshaller.Instance; options.ResponseUnmarshaller = GetTagsResponseUnmarshaller.Instance; return(InvokeAsync <GetTagsResponse>(request, options, cancellationToken)); }
internal virtual GetTagsResponse GetTags(GetTagsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetTagsRequestMarshaller.Instance; options.ResponseUnmarshaller = GetTagsResponseUnmarshaller.Instance; return(Invoke <GetTagsResponse>(request, options)); }
public void GetTags(EventHandler <string> OnTagsSuccess, EventHandler <string> OnError) { GetTagsRequest request = new GetTagsRequest { AppId = AppID }; PushwooshAPIServiceBase.InternalSendRequestAsync(request, (obj, arg) => { if (OnTagsSuccess != null) { OnTagsSuccess(this, request.Tags.ToString()); } }, OnError); }
/// <summary> /// Gets the tags. /// </summary> /// <param name="request">The request.</param> /// <returns> /// The list of tag entities /// </returns> /// <exception cref="CmsApiException"></exception> public DataListResponse <Tag> GetTags(GetTagsRequest request = null) { try { return(Repository.ToDataListResponse(request)); } catch (Exception inner) { const string message = "Failed to get tags list."; Logger.Error(message, inner); throw new CmsApiException(message, inner); } }
public void Should_Return_Filtered_Ordered_Paged_Tags_List_Successfully() { var fakeTags = CreateTags().ToList(); var repositoryMock = MockRepository(fakeTags); using (var service = new PagesApiContext(Container.BeginLifetimeScope(), repositoryMock.Object)) { var request = new GetTagsRequest(t => t.Name.Contains("Tag"), null, true); request.AddPaging(1, 2); var tags = service.GetTags(request); Assert.IsNotNull(tags); Assert.AreEqual(tags.Items.Count, 1); Assert.AreEqual(tags.TotalCount, 3); var fakeTag = fakeTags.First(t => t.Name == "Tag2"); var tag = tags.Items[0]; Assert.IsNotNull(tag); Assert.AreEqual(fakeTag.Id, tag.Id); } }
public async void TestGet() { String accessToken = this.RandomString(); String tagId = this.RandomString(); List <String> tagIds = new List <String> { tagId }; GetTagsRequest req = new GetTagsRequest(); req.TagIds = tagIds; MockAPI <Tags> mock = this.MockFor <Tags>( HttpMethod.Post, "/api/v1/tags.get", m => m.WithContent(req.ToString()) .Respond("application/json", "{ \"tags\": [{\"tagId\":\"" + tagId + "\"}]}") ); APIResponse <TagsResponseBody> res = await mock.Instance.Get(accessToken, tagIds, null); mock.Handler.VerifyNoOutstandingExpectation(); Assert.Equal(res.Body.Tags.Count, 1); }
/// <summary> /// Gets the tags list. /// </summary> /// <param name="request">The request.</param> /// <returns> /// <c>GetTagsResponse</c> with tags list. /// </returns> public GetTagsResponse Get(GetTagsRequest request) { request.Data.SetDefaultOrder("Name"); var listResponse = repository .AsQueryable <Module.Root.Models.Tag>() .Select(tag => new TagModel { Id = tag.Id, Version = tag.Version, CreatedBy = tag.CreatedByUser, CreatedOn = tag.CreatedOn, LastModifiedBy = tag.ModifiedByUser, LastModifiedOn = tag.ModifiedOn, Name = tag.Name }) .ToDataListResponse(request); return(new GetTagsResponse { Data = listResponse }); }
/// <summary> /// Gets the tags list. /// </summary> /// <param name="request">The request.</param> /// <returns> /// <c>GetTagsResponse</c> with tags list. /// </returns> public GetTagsResponse Get(GetTagsRequest request) { request.Data.SetDefaultOrder("Name"); var listResponse = repository .AsQueryable<Module.Root.Models.Tag>() .Select(tag => new TagModel { Id = tag.Id, Version = tag.Version, CreatedBy = tag.CreatedByUser, CreatedOn = tag.CreatedOn, LastModifiedBy = tag.ModifiedByUser, LastModifiedOn = tag.ModifiedOn, Name = tag.Name }) .ToDataListResponse(request); return new GetTagsResponse { Data = listResponse }; }
/// <summary> /// Gets the tags. /// </summary> /// <param name="request">The request.</param> /// <returns> /// The list of tag entities /// </returns> /// <exception cref="CmsApiException"></exception> public DataListResponse<Tag> GetTags(GetTagsRequest request = null) { try { return Repository.ToDataListResponse(request); } catch (Exception inner) { const string message = "Failed to get tags list."; Logger.Error(message, inner); throw new CmsApiException(message, inner); } }
public IActionResult GetTags([FromBody] GetTagsRequest request) { var result = new GetAllTags(dbContext).Run(request.PageSize, request.PageNo, request.Filter); return(Ok(new GetTagsViewModel(result))); }