Skip to content

Commit

Permalink
fix: adjust wrappers to the new generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nurjalal committed Oct 28, 2021
1 parent b0dbcb5 commit 744b193
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,39 +124,6 @@ func (l *LeaderboardConfigurationService) CreateLeaderboardConfigurationPublicV1
return ok.GetPayload(), nil
}

func (l *LeaderboardConfigurationService) DeleteBulkLeaderboardsV1(input *leaderboard_configuration.DeleteBulkLeaderboardsV1Params) (*leaderboardclientmodels.ModelsDeleteBulkLeaderboardsResp, error) {
token, err := l.TokenRepository.GetToken()
if err != nil {
return nil, err
}
ok, badRequest, unauthorized, forbidden, internalServerError, err := l.Client.LeaderboardConfiguration.DeleteBulkLeaderboardsV1(input, client.BearerToken(*token.AccessToken))
if badRequest != nil {
errorMsg, _ := json.Marshal(*badRequest.GetPayload())
logrus.Error(string(errorMsg))
return nil, badRequest
}
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if internalServerError != nil {
errorMsg, _ := json.Marshal(*internalServerError.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServerError
}
if err != nil {
logrus.Error(err)
return nil, err
}
return ok.GetPayload(), nil
}

func (l *LeaderboardConfigurationService) DeleteLeaderboardConfigurationAdminV1(input *leaderboard_configuration.DeleteLeaderboardConfigurationAdminV1Params) error {
token, err := l.TokenRepository.GetToken()
if err != nil {
Expand Down
68 changes: 0 additions & 68 deletions services-api/pkg/service/lobby/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,40 +579,6 @@ func (n *NotificationService) GetAllNotificationTopicsV1Admin(input *notificatio
return ok.GetPayload(), nil
}

func (n *NotificationService) GetAllStoredNotificationsV1(input *notification.GetAllStoredNotificationsV1Params) ([]*lobbyclientmodels.ModelGetStoredNotificationResp, error) {
token, err := n.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
return nil, err
}
ok, unauthorized, forbidden, notFound, internalServerError, err := n.Client.Notification.GetAllStoredNotificationsV1(input, client.BearerToken(*token.AccessToken))
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
}
if internalServerError != nil {
errorMsg, _ := json.Marshal(*internalServerError.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServerError
}
if err != nil {
logrus.Error(err)
return nil, err
}
return ok.GetPayload(), nil
}

func (n *NotificationService) GetGameTemplate(input *notification.GetGameTemplateParams) ([]*lobbyclientmodels.ModelTemplateResponse, error) {
token, err := n.TokenRepository.GetToken()
if err != nil {
Expand Down Expand Up @@ -715,40 +681,6 @@ func (n *NotificationService) GetNotificationTopicV1Admin(input *notification.Ge
return ok.GetPayload(), nil
}

func (n *NotificationService) GetNotifications(input *notification.GetNotificationsParams) ([]*lobbyclientmodels.ModelNotificationResponse, error) {
token, err := n.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
return nil, err
}
ok, unauthorized, forbidden, notFound, internalServerError, err := n.Client.Notification.GetNotifications(input, client.BearerToken(*token.AccessToken))
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
}
if internalServerError != nil {
errorMsg, _ := json.Marshal(*internalServerError.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServerError
}
if err != nil {
logrus.Error(err)
return nil, err
}
return ok.GetPayload(), nil
}

func (n *NotificationService) GetSingleTemplateLocalizationV1Admin(input *notification.GetSingleTemplateLocalizationV1AdminParams) (*lobbyclientmodels.ModelLocalization, error) {
token, err := n.TokenRepository.GetToken()
if err != nil {
Expand Down
81 changes: 0 additions & 81 deletions services-api/pkg/service/lobby/party.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,6 @@ type PartyService struct {
TokenRepository repository.TokenRepository
}

func (p *PartyService) AdminGetPartiesDataV1(input *party.AdminGetPartiesDataV1Params) ([]*lobbyclientmodels.ModelsPartyData, error) {
token, err := p.TokenRepository.GetToken()
if err != nil {
return nil, err
}
ok, badRequest, unauthorized, forbidden, notFound, internalServerError, err := p.Client.Party.AdminGetPartiesDataV1(input, client.BearerToken(*token.AccessToken))
if badRequest != nil {
errorMsg, _ := json.Marshal(*badRequest.GetPayload())
logrus.Error(string(errorMsg))
return nil, badRequest
}
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
}
if internalServerError != nil {
errorMsg, _ := json.Marshal(*internalServerError.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServerError
}
if err != nil {
logrus.Error(err)
return nil, err
}
return ok.GetPayload(), nil
}

func (p *PartyService) AdminGetPartyDataV1(input *party.AdminGetPartyDataV1Params) (*lobbyclientmodels.ModelsPartyData, error) {
token, err := p.TokenRepository.GetToken()
if err != nil {
Expand Down Expand Up @@ -129,49 +91,6 @@ func (p *PartyService) AdminGetUserPartyV1(input *party.AdminGetUserPartyV1Param
return ok.GetPayload(), nil
}

func (p *PartyService) AdminUpdatePartyAttributesV1(input *party.AdminUpdatePartyAttributesV1Params) (*lobbyclientmodels.ModelsPartyData, error) {
token, err := p.TokenRepository.GetToken()
if err != nil {
return nil, err
}
ok, badRequest, unauthorized, forbidden, notFound, preconditionFailed, internalServerError, err := p.Client.Party.AdminUpdatePartyAttributesV1(input, client.BearerToken(*token.AccessToken))
if badRequest != nil {
errorMsg, _ := json.Marshal(*badRequest.GetPayload())
logrus.Error(string(errorMsg))
return nil, badRequest
}
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
}
if preconditionFailed != nil {
errorMsg, _ := json.Marshal(*preconditionFailed.GetPayload())
logrus.Error(string(errorMsg))
return nil, preconditionFailed
}
if internalServerError != nil {
errorMsg, _ := json.Marshal(*internalServerError.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServerError
}
if err != nil {
logrus.Error(err)
return nil, err
}
return ok.GetPayload(), nil
}

func (p *PartyService) PublicGetPartyDataV1(input *party.PublicGetPartyDataV1Params) (*lobbyclientmodels.ModelsPartyData, error) {
token, err := p.TokenRepository.GetToken()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions services-api/pkg/service/platform/entitlement.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (e *EntitlementService) UpdateUserEntitlement(input *entitlement.UpdateUser
return userEntitlement.GetPayload(), nil
}

func (e *EntitlementService) GetUserEntitlementOwnershipBySku(input *entitlement.GetUserEntitlementOwnershipBySkuParams) (*platformclientmodels.Ownership, error) {
func (e *EntitlementService) GetUserEntitlementOwnershipBySku(input *entitlement.GetUserEntitlementOwnershipBySkuParams) (*platformclientmodels.TimedOwnership, error) {
accessToken, err := e.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
Expand Down Expand Up @@ -449,7 +449,7 @@ func (e *EntitlementService) PublicGetMyAppEntitlementOwnershipByAppID(input *en
return ownershipByAppID.GetPayload(), nil
}

func (e *EntitlementService) PublicGetMyEntitlementOwnershipBySku(input *entitlement.PublicGetMyEntitlementOwnershipBySkuParams) (*platformclientmodels.Ownership, error) {
func (e *EntitlementService) PublicGetMyEntitlementOwnershipBySku(input *entitlement.PublicGetMyEntitlementOwnershipBySkuParams) (*platformclientmodels.TimedOwnership, error) {
accessToken, err := e.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
Expand Down Expand Up @@ -555,7 +555,7 @@ func (e *EntitlementService) PublicDeleteUserDistributionReceiver(input *entitle
return nil
}

func (e *EntitlementService) PublicGetUserEntitlementOwnershipBySku(input *entitlement.PublicGetUserEntitlementOwnershipBySkuParams) (*platformclientmodels.Ownership, error) {
func (e *EntitlementService) PublicGetUserEntitlementOwnershipBySku(input *entitlement.PublicGetUserEntitlementOwnershipBySkuParams) (*platformclientmodels.TimedOwnership, error) {
accessToken, err := e.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
Expand Down
14 changes: 12 additions & 2 deletions services-api/pkg/service/sessionbrowser/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,17 @@ func (b *SessionService) CreateSession(input *sessionBrowser.CreateSessionParams
logrus.Error(err)
return nil, err
}
ok, badRequest, conflict, internalServer, err := b.Client.Session.CreateSession(input, client.BearerToken(*token.AccessToken))
ok, badRequest, forbidden, conflict, internalServer, err := b.Client.Session.CreateSession(input, client.BearerToken(*token.AccessToken))
if badRequest != nil {
errorMsg, _ := json.Marshal(*badRequest.GetPayload())
logrus.Error(string(errorMsg))
return nil, badRequest
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if conflict != nil {
errorMsg, _ := json.Marshal(*conflict.GetPayload())
logrus.Error(string(errorMsg))
Expand Down Expand Up @@ -377,12 +382,17 @@ func (b *SessionService) JoinSession(input *sessionBrowser.JoinSessionParams) (*
logrus.Error(err)
return nil, err
}
ok, badRequest, notFound, internalServer, err := b.Client.Session.JoinSession(input, client.BearerToken(*token.AccessToken))
ok, badRequest, forbidden, notFound, internalServer, err := b.Client.Session.JoinSession(input, client.BearerToken(*token.AccessToken))
if badRequest != nil {
errorMsg, _ := json.Marshal(*badRequest.GetPayload())
logrus.Error(string(errorMsg))
return nil, badRequest
}
if forbidden != nil {
errorMsg, _ := json.Marshal(*forbidden.GetPayload())
logrus.Error(string(errorMsg))
return nil, forbidden
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
Expand Down
32 changes: 16 additions & 16 deletions services-api/pkg/service/ugc/adminChannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ func (u *AdminChannelService) AdminCreateChannel(input *nr_admin_channel.AdminCr
}

// AdminDeleteChannel deletes channel
func (u *AdminChannelService) AdminDeleteChannel(input *nr_admin_channel.AdminDeleteChannelParams) (*ugcclientmodels.ModelsChannelResponse, error) {
func (u *AdminChannelService) AdminDeleteChannel(input *nr_admin_channel.AdminDeleteChannelParams) error {
token, err := u.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
return nil, err
return err
}
ok, unauthorized, notFound, internalServer, err := u.Client.NrAdminChannel.AdminDeleteChannel(input, client.BearerToken(*token.AccessToken))
_, unauthorized, notFound, internalServer, err := u.Client.NrAdminChannel.AdminDeleteChannel(input, client.BearerToken(*token.AccessToken))
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
return unauthorized
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
return notFound
}
if internalServer != nil {
errorMsg, _ := json.Marshal(*internalServer.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServer
return internalServer
}
if err != nil {
logrus.Error(err)
return nil, err
return err
}
return ok.GetPayload(), nil
return nil
}

// AdminGetChannel gets channels
Expand Down Expand Up @@ -145,33 +145,33 @@ func (u *AdminChannelService) AdminUpdateChannel(input *nr_admin_channel.AdminUp
}

// SingleAdminDeleteChannel deletes channel
func (u *AdminChannelService) SingleAdminDeleteChannel(input *nr_admin_channel.SingleAdminDeleteChannelParams) (*ugcclientmodels.ModelsChannelResponse, error) {
func (u *AdminChannelService) SingleAdminDeleteChannel(input *nr_admin_channel.SingleAdminDeleteChannelParams) error {
token, err := u.TokenRepository.GetToken()
if err != nil {
logrus.Error(err)
return nil, err
return err
}
ok, unauthorized, notFound, internalServer, err := u.Client.NrAdminChannel.SingleAdminDeleteChannel(input, client.BearerToken(*token.AccessToken))
_, unauthorized, notFound, internalServer, err := u.Client.NrAdminChannel.SingleAdminDeleteChannel(input, client.BearerToken(*token.AccessToken))
if unauthorized != nil {
errorMsg, _ := json.Marshal(*unauthorized.GetPayload())
logrus.Error(string(errorMsg))
return nil, unauthorized
return unauthorized
}
if notFound != nil {
errorMsg, _ := json.Marshal(*notFound.GetPayload())
logrus.Error(string(errorMsg))
return nil, notFound
return notFound
}
if internalServer != nil {
errorMsg, _ := json.Marshal(*internalServer.GetPayload())
logrus.Error(string(errorMsg))
return nil, internalServer
return internalServer
}
if err != nil {
logrus.Error(err)
return nil, err
return err
}
return ok.GetPayload(), nil
return nil
}

// SingleAdminGetChannel gets channel
Expand Down
Loading

0 comments on commit 744b193

Please sign in to comment.