Example #1
0
        public async Task <IActionResult> PostContributor(string appId, [FromBody] AddContributorDto request)
        {
            var update = request.ToUpdate(UserId);

            var app = await appStore.UpsertAsync(appId, update, HttpContext.RequestAborted);

            var response = await AppDetailsDto.FromDomainObjectAsync(app, UserId, userResolver);

            return(Ok(response));
        }
Example #2
0
        public override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            AppId = await Factories.CreateAsync(nameof(AppName), async() =>
            {
                var appId = await FindAppAsync();

                if (appId != null)
                {
                    return(appId);
                }

                try
                {
                    await Client.Apps.PostAppAsync(new UpsertAppDto
                    {
                        Name      = AppName,
                        Languages = new List <string>
                        {
                            "en",
                            "de"
                        }
                    });
                }
                catch (NotifoException ex)
                {
                    if (ex.StatusCode != 400)
                    {
                        throw;
                    }
                }

                appId = await FindAppAsync();

                string[] contributors =
                {
                    "*****@*****.**"
                };

                var invite = new AddContributorDto {
                    Role = "Owner"
                };

                foreach (var contributor in contributors)
                {
                    invite.Email = contributor;

                    await Client.Apps.PostContributorAsync(appId, invite);
                }

                return(appId);
            });
        }