eXpand icon indicating copy to clipboard operation
eXpand copied to clipboard

A reactive minimum friction module for calling Rest api

Open apobekiaris opened this issue 3 years ago • 6 comments

Provide a module that we can define bindings (e.g. CRUD ) for a non-presistent DomainComponent. Operations such List, Create, Delete, Updated, possibly can be supported easy, the rest as we go

apobekiaris avatar Mar 08 '21 12:03 apobekiaris

We will try to answer all questions that do not require research within 24hr. To prioritize cases that require research we use the following labels in order. For all other issues the posting time is respected.

  1. ❇️ Exclusive-Services
  2. ❤ Bronze Sponsor
  3. ❤ Sponsor
  4. ❤ Backer
  5. Installation
  6. ShowStopper
  7. Nuget
  8. Contribution
  9. BreakingChange
  10. ReproSample
  11. Deployment
  12. must-have

This case is prioritized.

apobekiaris avatar Mar 08 '21 21:03 apobekiaris

In the screencast you can see the Xpand.XAF.Modules.Reactive.Rest package in action mapping code less the 3Commas crypto bot Rest api

https://3commas.io/ https://github.com/3commas-io

3Commas

apobekiaris avatar Mar 27 '21 15:03 apobekiaris

Is the source code of this sample project available?

vimarx avatar Mar 28 '21 19:03 vimarx

source code exists of course however I do not plan to distribute a 3Commas package. The module contains mostly BO like the Account for example, note the RestOperation, RestProperty attributes, and the ReactiveCollections

    [DomainComponent]
    [DefaultClassOptions]
    [XafDefaultProperty(nameof(Name))]
    [RestOperation(Operation.Update, BaseEndPoint+"/update","POST")]
    [RestOperation(Operation.Get, BaseEndPoint,PollInterval = DailyPoll)]
    [Appearance("TodayLosingColor", AppearanceItemType.ViewItem, nameof(DayProfitUsd) + " Is not null and "+ nameof(DayProfitUsd) + " <0",
        TargetItems = nameof(DayProfitUsd) , FontColor = "Orange")]
    [Appearance("OverallLosingColor", AppearanceItemType.ViewItem, nameof(TotalUsdProfit) + " Is not null and "+ nameof(TotalUsdProfit) + " <0",
        TargetItems = nameof(TotalUsdProfit) , FontColor = "Orange")]
    [ReadOnlyObjectView(allowEdit:true,allowDelete:true)]
    public class Account:NonPersistentBaseObject {
        public const string BaseEndPoint = "/ver1/accounts";
        private const string InstanceEndPoint = BaseEndPoint+"/{" + nameof(Id) + "}/";

        [JsonProperty("id")] [Key][InvisibleInAllViews]
        public long Id { get; set; }

        [JsonProperty("account_id")] [Browsable(false)]
        public long AccountId => Id;

        [JsonProperty("supported_market_types")]
        [RestProperty(nameof(SupportedMarketTypes))]
        public IList<string> SupportedMarketTypesList { get; set; }

        [ReadOnlyCollection()][JsonIgnore]
        public BindingList<ObjectString> SupportedMarketTypes { get; private set; }

        [RestProperty(nameof(HttpMethod.Get), InstanceEndPoint +"active_trading_entities",HandleErrors=true)]
        [JsonIgnore]
        public ReactiveCollection<ActiveTradingEntity> ActiveTradingEntities { get; protected set; }
        
        [RestProperty(nameof(HttpMethod.Post), InstanceEndPoint +"account_table_data")]
        [JsonIgnore]
        public ReactiveCollection<AccountTableData> AccountTableData { get; protected set; }

        [JsonProperty("market_code")] 
        [RestProperty(nameof(MarketName))]
        [VisibleInListView(false)]
        public string MarketCode { get; set; }
        [DisplayName(nameof(Market))]
        public Market MarketName { get; set; }

        [JsonProperty("auto_balance_period")] [VisibleInListView(false)]
        [EditorAlias(EditorAliases.DisplayText)]
        public int AutoBalancePeriod { get; set; }

        [JsonProperty("auto_balance_portfolio_id")][VisibleInListView(false)]
        [EditorAlias(EditorAliases.DisplayText)]
        public int? AutoBalancePortfolioId { get; set; }

        [JsonProperty("auto_balance_currency_change_limit")][VisibleInListView(false)]
        [EditorAlias(EditorAliases.DisplayText)]
        public decimal? AutoBalanceCurrencyChangeLimit { get; set; }

apobekiaris avatar Mar 28 '21 19:03 apobekiaris

The pre-release 4.202.53.0 in the Reactive.XAF lab branch includes commits that relate to this task:

To minimize version conflicts we recommend that you use the Xpand.XAF.Core.All, Xpand.XAF.Win.All, Xpand.XAF.Web.All packages. Doing so, all packages will be at your disposal and .NET will add a dependecy only to those packages that you actually use and not to all (see the Modules installation-registrations youtube video).

Released packages: Xpand.Extensions v.4.202.53 Xpand.Extensions.Blazor v.4.202.53 Xpand.Extensions.Mono.Cecil v.4.202.53 Xpand.Extensions.Office.Cloud v.4.202.53 Xpand.Extensions.Office.Cloud.Google.Blazor v.4.202.53 Xpand.Extensions.Reactive v.4.202.53 Xpand.Extensions.XAF v.4.202.53 Xpand.Extensions.XAF.Xpo v.4.202.53 Xpand.TestsLib v.4.202.53 Xpand.TestsLib.Blazor v.4.202.53 Xpand.TestsLib.Common v.4.202.53 Xpand.TestsLib.Net461 v.4.202.53 Xpand.VersionConverter v.4.202.53 Xpand.XAF.Core.All v.4.202.53 Xpand.XAF.Modules.AutoCommit v.4.202.53 Xpand.XAF.Modules.Blazor v.4.202.53 Xpand.XAF.Modules.CloneMemberValue v.4.202.53 Xpand.XAF.Modules.CloneModelView v.4.202.53 Xpand.XAF.Modules.GridListEditor v.4.202.53 Xpand.XAF.Modules.HideToolBar v.4.202.53 Xpand.XAF.Modules.JobScheduler.Hangfire v.4.202.53 Xpand.XAF.Modules.LookupCascade v.4.202.53 Xpand.XAF.Modules.MasterDetail v.4.202.53 Xpand.XAF.Modules.ModelMapper v.4.202.53 Xpand.XAF.Modules.ModelViewInheritance v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Google v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Google.Calendar v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Google.Tasks v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Microsoft v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Microsoft.Calendar v.4.202.53 Xpand.XAF.Modules.Office.Cloud.Microsoft.Todo v.4.202.53 Xpand.XAF.Modules.Office.DocumentStyleManager v.4.202.53 Xpand.XAF.Modules.OneView v.4.202.53 Xpand.XAF.Modules.PositionInListView v.4.202.53 Xpand.XAF.Modules.ProgressBarViewItem v.4.202.53 Xpand.XAF.Modules.Reactive v.4.202.53 Xpand.XAF.Modules.Reactive.Logger v.4.202.53 Xpand.XAF.Modules.Reactive.Logger.Client.Win v.4.202.53 Xpand.XAF.Modules.Reactive.Logger.Hub v.4.202.53 Xpand.XAF.Modules.Reactive.Rest v.4.202.53 Xpand.XAF.Modules.RefreshView v.4.202.53 Xpand.XAF.Modules.SequenceGenerator v.4.202.53 Xpand.XAF.Modules.SuppressConfirmation v.4.202.53 Xpand.XAF.Modules.ViewEditMode v.4.202.53 Xpand.XAF.Modules.ViewItemValue v.4.202.53 Xpand.XAF.Modules.ViewWizard v.4.202.53 Xpand.XAF.Web.All v.4.202.53 Xpand.XAF.Win.All v.4.202.53

Please update the related Nuget packages and test if issues is addressed. These are nightly nuget packages available only from our NugetServer.

If you do not use these packages directly but through a module of the main eXpandFramework project, please wait for the bot to notify you again when integration is finished or update the related packages manually.

Thanks a lot for your contribution.

apobekiaris avatar Apr 10 '21 12:04 apobekiaris

Issue is deprioritized as no Assignee found and scheduled for auto-close if no activity in the next 60 days. Thanks a lot for your contribution.

apobekiaris avatar Aug 14 '21 21:08 apobekiaris

Closing issue for age. Feel free to reopen it at any time.

.Thank you for your contribution.

expand avatar Nov 17 '23 21:11 expand