DigitalOcean.API.Clients.TagsClient.Get C# (CSharp) Method

Get() public method

Retrieve an individual Tag by name
public Get ( string tagName ) : Task
tagName string
return Task
        public Task<Tag> Get(string tagName) {
            var parameters = new List<Parameter> {
                new Parameter { Name = "name", Value = tagName, Type = ParameterType.UrlSegment }
            };
            return _connection.ExecuteRequest<Tag>("tags/{name}", parameters, null, "tag");
        }

Usage Example

        public void CorrectRequestForGet() {
            var factory = Substitute.For<IConnection>();
            var client = new TagsClient(factory);

            client.Get("notarealtag");

            var parameters = Arg.Is<List<Parameter>>(list => (string)list[0].Value == "notarealtag");
            factory.Received().ExecuteRequest<Tag>("tags/{name}", parameters, null, "tag");
        }