Objetivo.ConteudoOnline.Cliente 1.2.1

dotnet add package Objetivo.ConteudoOnline.Cliente --version 1.2.1                
NuGet\Install-Package Objetivo.ConteudoOnline.Cliente -Version 1.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Objetivo.ConteudoOnline.Cliente" Version="1.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Objetivo.ConteudoOnline.Cliente --version 1.2.1                
#r "nuget: Objetivo.ConteudoOnline.Cliente, 1.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Objetivo.ConteudoOnline.Cliente as a Cake Addin
#addin nuget:?package=Objetivo.ConteudoOnline.Cliente&version=1.2.1

// Install Objetivo.ConteudoOnline.Cliente as a Cake Tool
#tool nuget:?package=Objetivo.ConteudoOnline.Cliente&version=1.2.1                

Objetivo - Conteúdo On-line Cliente

Pacote para facilitar o uso da API para acessar dados e arquivos, referentes ao Conteúdo On-line.

Último release

Release 1.2.1

  • fix: Passando regime como texto, no filtro por nome da aula, já que passar ser valor por extenso
  • fix: Passando frente como texto, no filtro por nome da aula, já que passar ser valor por extenso

Configuração

Para pode usar os recursos do pacote, são necessárias 4 (quatro) configurações:

  • URL: (OBRIGATÓRIO) Informar a URL da API que irá ser carregada.
  • Chave Pública: (OBRIGATÓRIO) Informar a chave pública de acesso a API.
  • Autorização: (OBRIGATÓRIO) Informar a autorização de acesso a API.
  • É produção: (OBRIGATÓRIO) Informar se a API está rodando em ambiente de produção.

É um Singleton, então só precisa ser atribuído uma única vez dependendo da sua aplicação:

Objetivo.ConteudoOnline.Cliente.Config.EhProducao = true;
Objetivo.ConteudoOnline.Cliente.Config.Url = "https://api.site.com.br/pasta/";
Objetivo.ConteudoOnline.Cliente.Config.ChavePublica = "160MYEAto65UhwwrJsTtCBgVpwpj499CML4rK7y1bFpZLMudMk";
Objetivo.ConteudoOnline.Cliente.Config.Autorizacao = "50ZekWXqO3yqphdXd1Ztv0MWLkx4Jyhb14FbPnMD0yHBWRM68x9";

Chamando API

Um exemplo de teste de obter os dados da API.

using Xunit;
using System.Threading.Tasks;
using Objetivo.ConteudoOnline.Cliente.Servicos;
using Objetivo.ConteudoOnline.Cliente.ObjetosDeValor;

namespace Seu.Projeto.Csharp.Teste
{
    public class SobreServTeste
    {
        [Fact]
        public async Task Obter()
        {
            SobreServ serv = new();
            Sobre dados = await serv.ObterAsync();

            Assert.True(serv.EhValido());
            Assert.NotNull(dados);
        }
    }
}

Algumas chamadas precisam de parâmetros, e neste caso, há classes para mandar esses valores. Para esse exemplo, vou usar o serviço de busca do grau.

using Xunit;
using System.Linq;
using System.Threading.Tasks;
using Objetivo.ConteudoOnline.Cliente.Servicos;
using Objetivo.ConteudoOnline.Cliente.Entidades;
using Objetivo.ConteudoOnline.Cliente.ObjetosDeValor;
using Objetivo.ConteudoOnline.Cliente.Comandos.GrauCmds;

namespace Seu.Projeto.Csharp.Teste
{
    public class GrauServTeste
    {
        [Fact]
        public async Task Filtro_valido()
        {
            GrauServ serv = new();
            FiltrarGrauCmd cmd = new()
            {
                Maximo = 1,
                Pagina = 1
            };
            ResultadoBusca<Grau> res = await serv.FiltrarAsync(cmd);
            Assert.True(res.ResultadosDaPaginaAtual.Any());
            Assert.True(serv.EhValido());
            Assert.False(serv.Avisos.Notificacoes.Any());
        }

        [Fact]
        public async Task Filtro_invalido()
        {
            GrauServ serv = new();
            FiltrarGrauCmd cmd = new()
            {
                Texto = "\"um texto inválido\"",
                Maximo = 1,
                Pagina = 1
            };
            ResultadoBusca<Grau> res = await serv.FiltrarAsync(cmd);
            Assert.False(res.ResultadosDaPaginaAtual.Any());
            Assert.False(serv.EhValido());
            Assert.True(serv.Avisos.Notificacoes.Any());
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 149 7/5/2023
1.2.0 128 6/30/2023
1.1.0 303 11/30/2021
1.0.0 892 11/29/2021