/// <summary>
        /// Creates a new label.
        /// </summary>
        public async Task <Label> CreateAsync(CreateLabelInput labelInput)
        {
            string queryString = new LabelQueryStringBuilder()
                                 .Build();

            return(await _proxy.Post <Label>(queryString, labelInput));
        }
        /// <summary>
        /// Lists all labels in the user's mailbox.
        /// </summary>
        /// <returns></returns>
        public async Task <IList <Label> > ListAsync()
        {
            string queryString = new LabelQueryStringBuilder()
                                 .Build();

            return(await _proxy.Get <IList <Label> >(queryString, new ParseOptions { Path = "labels" }));
        }
        /// <summary>
        /// Updates the specified label. This method supports patch semantics.
        /// </summary>
        /// <param name="label"></param>
        public async Task <Label> PatchAsync(Label label)
        {
            string queryString = new LabelQueryStringBuilder()
                                 .SetRequestAction(LabelRequestAction.Update, label.Id)
                                 .Build();

            return(await _proxy.Patch <Label>(queryString, label));
        }
        /// <summary>
        /// Updates the specified label.
        /// </summary>
        /// <param name="labelInput"></param>
        public async Task <Label> UpdateAsync(UpdateLabelInput labelInput)
        {
            string queryString = new LabelQueryStringBuilder()
                                 .SetRequestAction(LabelRequestAction.Update, labelInput.Id)
                                 .Build();

            return(await _proxy.Put <Label>(queryString, labelInput));
        }
        /// <summary>
        /// WARNING: Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.
        /// </summary>
        /// <param name="id">The ID of the label to delete.</param>
        public async Task DeleteAsync(string id)
        {
            string queryString = new LabelQueryStringBuilder()
                                 .SetRequestAction(LabelRequestAction.Delete, id)
                                 .Build();

            await _proxy.Delete(queryString);
        }
        /// <summary>
        /// Gets the specified label.
        /// </summary>
        /// <param name="id">The ID of the label to retrieve.</param>
        /// <returns></returns>
        public async Task <Label> GetAsync(string id)
        {
            string queryString = new LabelQueryStringBuilder()
                                 .SetRequestAction(LabelRequestAction.Get, id)
                                 .Build();

            return(await _proxy.Get <Label>(queryString));
        }
Beispiel #7
0
        public void RequestActionList_CanSet()
        {
            // Act
            string queryString = new LabelQueryStringBuilder()
                                 .SetRequestAction(LabelRequestAction.List)
                                 .Build();

            // Assert
            queryString.Should().Be(Path);
        }
Beispiel #8
0
        public void AllLabelFields_ReturnsNoValue()
        {
            // Act
            string queryString = new LabelQueryStringBuilder()
                                 .SetFields(LabelFields.All)
                                 .Build();

            // Assert
            queryString.Should().Be(Path);
        }
Beispiel #9
0
        public void RequestActionGet_CanSet()
        {
            // Act
            const string id          = "id";
            string       queryString = new LabelQueryStringBuilder()
                                       .SetRequestAction(LabelRequestAction.Get, id)
                                       .Build();

            // Assert
            queryString.Should().Be(Path + "/" + id);
        }