From ee2893e2591c51f2a0a1bd5c5b5203a38561c349 Mon Sep 17 00:00:00 2001 From: NathanFlurry Date: Thu, 16 May 2024 01:16:54 +0000 Subject: [PATCH] chore(push-notification): remove unused push notification code (#776) ## Changes --- fern/definition/portal/notifications.yml | 31 -- lib/convert/src/impls/portal.rs | 12 - scripts/openapi/gen_rust.sh | 1 - sdks/full/go/portal/client/client.go | 13 +- sdks/full/go/portal/notifications.go | 62 ---- sdks/full/go/portal/notifications/client.go | 194 ------------- sdks/full/go/portal/types.go | 19 ++ sdks/full/openapi/openapi.yml | 112 ------- sdks/full/openapi_compat/openapi.yml | 112 ------- sdks/full/rust-cli/.openapi-generator/FILES | 4 - sdks/full/rust-cli/README.md | 3 - .../rust-cli/docs/PortalNotificationsApi.md | 70 ----- .../PortalRegisterNotificationsRequest.md | 11 - sdks/full/rust-cli/src/apis/mod.rs | 1 - .../src/apis/portal_notifications_api.rs | 108 ------- sdks/full/rust-cli/src/models/mod.rs | 2 - .../portal_register_notifications_request.rs | 28 -- sdks/full/rust/.openapi-generator/FILES | 4 - sdks/full/rust/README.md | 3 - sdks/full/rust/docs/PortalNotificationsApi.md | 70 ----- .../PortalRegisterNotificationsRequest.md | 11 - sdks/full/rust/src/apis/mod.rs | 1 - .../rust/src/apis/portal_notifications_api.rs | 108 ------- sdks/full/rust/src/models/mod.rs | 2 - .../portal_register_notifications_request.rs | 28 -- sdks/full/typescript/archive.tgz | 4 +- .../src/api/resources/portal/client/Client.ts | 7 - .../api/resources/portal/resources/index.ts | 3 - .../resources/notifications/client/Client.ts | 273 ------------------ .../resources/notifications/client/index.ts | 1 - .../UnregisterNotificationsRequest.ts | 12 - .../notifications/client/requests/index.ts | 1 - .../portal/resources/notifications/index.ts | 2 - .../resources/portal/resources/index.ts | 2 - .../portal/resources/notifications/index.ts | 1 - svc/Cargo.lock | 65 ----- svc/Cargo.toml | 3 - svc/api/portal/Cargo.toml | 2 - svc/api/portal/src/route/mod.rs | 11 - svc/api/portal/src/route/notifications.rs | 56 ---- svc/pkg/monolith/standalone/worker/Cargo.toml | 1 - svc/pkg/monolith/standalone/worker/src/lib.rs | 1 - .../push-notification/types/msg/create.proto | 19 -- svc/pkg/push-notification/worker/Cargo.toml | 20 -- svc/pkg/push-notification/worker/Service.toml | 10 - svc/pkg/push-notification/worker/src/lib.rs | 1 - .../worker/src/workers/mod.rs | 3 - .../worker/src/workers/send.rs | 89 ------ .../push-notification/worker/tests/send.rs | 10 - .../db/user-notification-auth/Service.toml | 7 - .../migrations/20200101000000_init.down.sql | 0 .../migrations/20200101000000_init.up.sql | 4 - .../ops/register/Cargo.toml | 20 -- .../ops/register/README.md | 1 - .../ops/register/Service.toml | 10 - .../ops/register/src/lib.rs | 23 -- .../ops/register/tests/integration.rs | 35 --- .../ops/unregister/Cargo.toml | 21 -- .../ops/unregister/README.md | 1 - .../ops/unregister/Service.toml | 10 - .../ops/unregister/src/lib.rs | 22 -- .../ops/unregister/tests/integration.rs | 58 ---- .../types/register.proto | 21 -- .../types/unregister.proto | 18 -- 64 files changed, 26 insertions(+), 1832 deletions(-) delete mode 100644 fern/definition/portal/notifications.yml delete mode 100644 sdks/full/go/portal/notifications.go delete mode 100644 sdks/full/go/portal/notifications/client.go delete mode 100644 sdks/full/rust-cli/docs/PortalNotificationsApi.md delete mode 100644 sdks/full/rust-cli/docs/PortalRegisterNotificationsRequest.md delete mode 100644 sdks/full/rust-cli/src/apis/portal_notifications_api.rs delete mode 100644 sdks/full/rust-cli/src/models/portal_register_notifications_request.rs delete mode 100644 sdks/full/rust/docs/PortalNotificationsApi.md delete mode 100644 sdks/full/rust/docs/PortalRegisterNotificationsRequest.md delete mode 100644 sdks/full/rust/src/apis/portal_notifications_api.rs delete mode 100644 sdks/full/rust/src/models/portal_register_notifications_request.rs delete mode 100644 sdks/full/typescript/src/api/resources/portal/resources/notifications/client/Client.ts delete mode 100644 sdks/full/typescript/src/api/resources/portal/resources/notifications/client/index.ts delete mode 100644 sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/UnregisterNotificationsRequest.ts delete mode 100644 sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/index.ts delete mode 100644 sdks/full/typescript/src/api/resources/portal/resources/notifications/index.ts delete mode 100644 sdks/full/typescript/src/serialization/resources/portal/resources/notifications/index.ts delete mode 100644 svc/api/portal/src/route/notifications.rs delete mode 100644 svc/pkg/push-notification/types/msg/create.proto delete mode 100644 svc/pkg/push-notification/worker/Cargo.toml delete mode 100644 svc/pkg/push-notification/worker/Service.toml delete mode 100644 svc/pkg/push-notification/worker/src/lib.rs delete mode 100644 svc/pkg/push-notification/worker/src/workers/mod.rs delete mode 100644 svc/pkg/push-notification/worker/src/workers/send.rs delete mode 100644 svc/pkg/push-notification/worker/tests/send.rs delete mode 100644 svc/pkg/user-notification-auth/db/user-notification-auth/Service.toml delete mode 100644 svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.down.sql delete mode 100644 svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.up.sql delete mode 100644 svc/pkg/user-notification-auth/ops/register/Cargo.toml delete mode 100644 svc/pkg/user-notification-auth/ops/register/README.md delete mode 100644 svc/pkg/user-notification-auth/ops/register/Service.toml delete mode 100644 svc/pkg/user-notification-auth/ops/register/src/lib.rs delete mode 100644 svc/pkg/user-notification-auth/ops/register/tests/integration.rs delete mode 100644 svc/pkg/user-notification-auth/ops/unregister/Cargo.toml delete mode 100644 svc/pkg/user-notification-auth/ops/unregister/README.md delete mode 100644 svc/pkg/user-notification-auth/ops/unregister/Service.toml delete mode 100644 svc/pkg/user-notification-auth/ops/unregister/src/lib.rs delete mode 100644 svc/pkg/user-notification-auth/ops/unregister/tests/integration.rs delete mode 100644 svc/pkg/user-notification-auth/types/register.proto delete mode 100644 svc/pkg/user-notification-auth/types/unregister.proto diff --git a/fern/definition/portal/notifications.yml b/fern/definition/portal/notifications.yml deleted file mode 100644 index 5fed01e063..0000000000 --- a/fern/definition/portal/notifications.yml +++ /dev/null @@ -1,31 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json - -imports: - localCommons: common.yml - -service: - auth: true - base-path: /portal/notifications/register - endpoints: - registerNotifications: - path: "" - method: POST - docs: Registers push notifications for the current identity. - request: - body: RegisterNotificationsRequest - - unregisterNotifications: - path: "" - method: DELETE - docs: Unregister push notification for the current identity. - request: - name: UnregisterNotificationsRequest - query-parameters: - service: - docs: Represents a value for which notification service to unregister. - type: localCommons.NotificationUnregisterService - -types: - RegisterNotificationsRequest: - properties: - service: localCommons.NotificationRegisterService diff --git a/lib/convert/src/impls/portal.rs b/lib/convert/src/impls/portal.rs index 581d3a3807..128fb26edb 100644 --- a/lib/convert/src/impls/portal.rs +++ b/lib/convert/src/impls/portal.rs @@ -23,15 +23,3 @@ impl ApiFrom for backend::team::Publicity { } } -impl ApiFrom - for user_notification_auth::unregister::request::Service -{ - fn api_from(value: models::NotificationUnregisterService) -> Self { - match value { - models::NotificationUnregisterService::Firebase => { - user_notification_auth::unregister::request::Service::Firebase - } - _ => user_notification_auth::unregister::request::Service::Firebase, - } - } -} diff --git a/scripts/openapi/gen_rust.sh b/scripts/openapi/gen_rust.sh index 6f877851ad..49eb3c97b5 100755 --- a/scripts/openapi/gen_rust.sh +++ b/scripts/openapi/gen_rust.sh @@ -18,7 +18,6 @@ docker run --rm \ -o "/data/$GEN_PATH_RUST" \ -p packageName=rivet-api - if [ "$FERN_GROUP" == "full" ]; then # Fix OpenAPI bug (https://github.com/OpenAPITools/openapi-generator/issues/14171) sed -i 's/CloudGamesLogStream/crate::models::CloudGamesLogStream/' "$GEN_PATH_RUST/src/apis/cloud_games_matchmaker_api.rs" diff --git a/sdks/full/go/portal/client/client.go b/sdks/full/go/portal/client/client.go index 2a683a2daf..1bc2dbee1a 100644 --- a/sdks/full/go/portal/client/client.go +++ b/sdks/full/go/portal/client/client.go @@ -6,7 +6,6 @@ import ( http "net/http" core "sdk/core" games "sdk/portal/games" - notifications "sdk/portal/notifications" ) type Client struct { @@ -14,8 +13,7 @@ type Client struct { caller *core.Caller header http.Header - Games *games.Client - Notifications *notifications.Client + Games *games.Client } func NewClient(opts ...core.ClientOption) *Client { @@ -24,10 +22,9 @@ func NewClient(opts ...core.ClientOption) *Client { opt(options) } return &Client{ - baseURL: options.BaseURL, - caller: core.NewCaller(options.HTTPClient), - header: options.ToHeader(), - Games: games.NewClient(opts...), - Notifications: notifications.NewClient(opts...), + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + Games: games.NewClient(opts...), } } diff --git a/sdks/full/go/portal/notifications.go b/sdks/full/go/portal/notifications.go deleted file mode 100644 index 873736058b..0000000000 --- a/sdks/full/go/portal/notifications.go +++ /dev/null @@ -1,62 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package portal - -import ( - json "encoding/json" - fmt "fmt" - core "sdk/core" -) - -type NotificationUnregisterService string - -const ( - NotificationUnregisterServiceFirebase NotificationUnregisterService = "firebase" -) - -func NewNotificationUnregisterServiceFromString(s string) (NotificationUnregisterService, error) { - switch s { - case "firebase": - return NotificationUnregisterServiceFirebase, nil - } - var t NotificationUnregisterService - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (n NotificationUnregisterService) Ptr() *NotificationUnregisterService { - return &n -} - -type RegisterNotificationsRequest struct { - Service *NotificationRegisterService `json:"service,omitempty"` - - _rawJSON json.RawMessage -} - -func (r *RegisterNotificationsRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RegisterNotificationsRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *r = RegisterNotificationsRequest(value) - r._rawJSON = json.RawMessage(data) - return nil -} - -func (r *RegisterNotificationsRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(r); err == nil { - return value - } - return fmt.Sprintf("%#v", r) -} - -type UnregisterNotificationsRequest struct { - // Represents a value for which notification service to unregister. - Service NotificationUnregisterService `json:"-"` -} diff --git a/sdks/full/go/portal/notifications/client.go b/sdks/full/go/portal/notifications/client.go deleted file mode 100644 index b640a46187..0000000000 --- a/sdks/full/go/portal/notifications/client.go +++ /dev/null @@ -1,194 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package notifications - -import ( - bytes "bytes" - context "context" - json "encoding/json" - errors "errors" - fmt "fmt" - io "io" - http "net/http" - url "net/url" - sdk "sdk" - core "sdk/core" - portal "sdk/portal" -) - -type Client struct { - baseURL string - caller *core.Caller - header http.Header -} - -func NewClient(opts ...core.ClientOption) *Client { - options := core.NewClientOptions() - for _, opt := range opts { - opt(options) - } - return &Client{ - baseURL: options.BaseURL, - caller: core.NewCaller(options.HTTPClient), - header: options.ToHeader(), - } -} - -// Registers push notifications for the current identity. -func (c *Client) RegisterNotifications(ctx context.Context, request *portal.RegisterNotificationsRequest) error { - baseURL := "https://api.rivet.gg" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := baseURL + "/" + "portal/notifications/register" - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 500: - value := new(sdk.InternalError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 429: - value := new(sdk.RateLimitError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 403: - value := new(sdk.ForbiddenError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 408: - value := new(sdk.UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 404: - value := new(sdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 400: - value := new(sdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - } - return apiError - } - - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodPost, - Headers: c.header, - Request: request, - ErrorDecoder: errorDecoder, - }, - ); err != nil { - return err - } - return nil -} - -// Unregister push notification for the current identity. -func (c *Client) UnregisterNotifications(ctx context.Context, request *portal.UnregisterNotificationsRequest) error { - baseURL := "https://api.rivet.gg" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := baseURL + "/" + "portal/notifications/register" - - queryParams := make(url.Values) - queryParams.Add("service", fmt.Sprintf("%v", request.Service)) - if len(queryParams) > 0 { - endpointURL += "?" + queryParams.Encode() - } - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 500: - value := new(sdk.InternalError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 429: - value := new(sdk.RateLimitError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 403: - value := new(sdk.ForbiddenError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 408: - value := new(sdk.UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 404: - value := new(sdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 400: - value := new(sdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - } - return apiError - } - - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodDelete, - Headers: c.header, - ErrorDecoder: errorDecoder, - }, - ); err != nil { - return err - } - return nil -} diff --git a/sdks/full/go/portal/types.go b/sdks/full/go/portal/types.go index 2ea70c17c5..b2be823531 100644 --- a/sdks/full/go/portal/types.go +++ b/sdks/full/go/portal/types.go @@ -68,6 +68,25 @@ func (n *NotificationRegisterService) String() string { return fmt.Sprintf("%#v", n) } +type NotificationUnregisterService string + +const ( + NotificationUnregisterServiceFirebase NotificationUnregisterService = "firebase" +) + +func NewNotificationUnregisterServiceFromString(s string) (NotificationUnregisterService, error) { + switch s { + case "firebase": + return NotificationUnregisterServiceFirebase, nil + } + var t NotificationUnregisterService + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (n NotificationUnregisterService) Ptr() *NotificationUnregisterService { + return &n +} + type GetSuggestedGamesResponse struct { // A list of game summaries. Games []*game.Summary `json:"games,omitempty"` diff --git a/sdks/full/openapi/openapi.yml b/sdks/full/openapi/openapi.yml index 38e2c4fc6b..b2c5826492 100644 --- a/sdks/full/openapi/openapi.yml +++ b/sdks/full/openapi/openapi.yml @@ -8826,111 +8826,6 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /portal/notifications/register: - post: - description: Registers push notifications for the current identity. - operationId: portal_notifications_registerNotifications - tags: - - PortalNotifications - parameters: [] - responses: - '204': - description: '' - '400': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '403': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '404': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '408': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '429': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '500': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/PortalRegisterNotificationsRequest' - delete: - description: Unregister push notification for the current identity. - operationId: portal_notifications_unregisterNotifications - tags: - - PortalNotifications - parameters: - - name: service - in: query - description: Represents a value for which notification service to unregister. - required: true - schema: - $ref: '#/components/schemas/PortalNotificationUnregisterService' - responses: - '204': - description: '' - '400': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '403': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '404': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '408': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '429': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '500': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - security: *ref_0 components: schemas: AdminLoginRequest: @@ -13504,13 +13399,6 @@ components: required: - game - watch - PortalRegisterNotificationsRequest: - type: object - properties: - service: - $ref: '#/components/schemas/PortalNotificationRegisterService' - required: - - service UploadPresignedRequest: type: object description: >- diff --git a/sdks/full/openapi_compat/openapi.yml b/sdks/full/openapi_compat/openapi.yml index 44c1f46100..89df278065 100644 --- a/sdks/full/openapi_compat/openapi.yml +++ b/sdks/full/openapi_compat/openapi.yml @@ -4413,13 +4413,6 @@ components: enum: - firebase type: string - PortalRegisterNotificationsRequest: - properties: - service: - $ref: '#/components/schemas/PortalNotificationRegisterService' - required: - - service - type: object ProvisionDatacentersGetTlsResponse: properties: job_cert_pem: @@ -13199,111 +13192,6 @@ paths: security: *id001 tags: - PortalGames - /portal/notifications/register: - delete: - description: Unregister push notification for the current identity. - operationId: portal_notifications_unregisterNotifications - parameters: - - description: Represents a value for which notification service to unregister. - in: query - name: service - required: true - schema: - $ref: '#/components/schemas/PortalNotificationUnregisterService' - responses: - '204': - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '408': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '429': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - security: *id001 - tags: - - PortalNotifications - post: - description: Registers push notifications for the current identity. - operationId: portal_notifications_registerNotifications - parameters: [] - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PortalRegisterNotificationsRequest' - required: true - responses: - '204': - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '408': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '429': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - security: *id001 - tags: - - PortalNotifications /servers/{ip}: get: operationId: provision_servers_getInfo diff --git a/sdks/full/rust-cli/.openapi-generator/FILES b/sdks/full/rust-cli/.openapi-generator/FILES index 738bfabf94..0f27fd894c 100644 --- a/sdks/full/rust-cli/.openapi-generator/FILES +++ b/sdks/full/rust-cli/.openapi-generator/FILES @@ -341,8 +341,6 @@ docs/PortalGetSuggestedGamesResponse.md docs/PortalNotificationRegisterFirebaseService.md docs/PortalNotificationRegisterService.md docs/PortalNotificationUnregisterService.md -docs/PortalNotificationsApi.md -docs/PortalRegisterNotificationsRequest.md docs/ProvisionDatacentersApi.md docs/ProvisionDatacentersGetTlsResponse.md docs/ProvisionServersApi.md @@ -391,7 +389,6 @@ src/apis/matchmaker_regions_api.rs src/apis/mod.rs src/apis/module_api.rs src/apis/portal_games_api.rs -src/apis/portal_notifications_api.rs src/apis/provision_datacenters_api.rs src/apis/provision_servers_api.rs src/lib.rs @@ -697,7 +694,6 @@ src/models/portal_get_suggested_games_response.rs src/models/portal_notification_register_firebase_service.rs src/models/portal_notification_register_service.rs src/models/portal_notification_unregister_service.rs -src/models/portal_register_notifications_request.rs src/models/provision_datacenters_get_tls_response.rs src/models/provision_servers_get_info_response.rs src/models/upload_prepare_file.rs diff --git a/sdks/full/rust-cli/README.md b/sdks/full/rust-cli/README.md index c42a835a13..9da43dcc47 100644 --- a/sdks/full/rust-cli/README.md +++ b/sdks/full/rust-cli/README.md @@ -164,8 +164,6 @@ Class | Method | HTTP request | Description *MatchmakerRegionsApi* | [**matchmaker_regions_list**](docs/MatchmakerRegionsApi.md#matchmaker_regions_list) | **GET** /matchmaker/regions | *ModuleApi* | [**module_call**](docs/ModuleApi.md#module_call) | **POST** /module/modules/{module}/scripts/{script}/call | *PortalGamesApi* | [**portal_games_get_game_profile**](docs/PortalGamesApi.md#portal_games_get_game_profile) | **GET** /portal/games/{game_name_id}/profile | -*PortalNotificationsApi* | [**portal_notifications_register_notifications**](docs/PortalNotificationsApi.md#portal_notifications_register_notifications) | **POST** /portal/notifications/register | -*PortalNotificationsApi* | [**portal_notifications_unregister_notifications**](docs/PortalNotificationsApi.md#portal_notifications_unregister_notifications) | **DELETE** /portal/notifications/register | *ProvisionDatacentersApi* | [**provision_datacenters_get_tls**](docs/ProvisionDatacentersApi.md#provision_datacenters_get_tls) | **GET** /datacenters/{datacenter_id}/tls | *ProvisionServersApi* | [**provision_servers_get_info**](docs/ProvisionServersApi.md#provision_servers_get_info) | **GET** /servers/{ip} | @@ -473,7 +471,6 @@ Class | Method | HTTP request | Description - [PortalNotificationRegisterFirebaseService](docs/PortalNotificationRegisterFirebaseService.md) - [PortalNotificationRegisterService](docs/PortalNotificationRegisterService.md) - [PortalNotificationUnregisterService](docs/PortalNotificationUnregisterService.md) - - [PortalRegisterNotificationsRequest](docs/PortalRegisterNotificationsRequest.md) - [ProvisionDatacentersGetTlsResponse](docs/ProvisionDatacentersGetTlsResponse.md) - [ProvisionServersGetInfoResponse](docs/ProvisionServersGetInfoResponse.md) - [UploadPrepareFile](docs/UploadPrepareFile.md) diff --git a/sdks/full/rust-cli/docs/PortalNotificationsApi.md b/sdks/full/rust-cli/docs/PortalNotificationsApi.md deleted file mode 100644 index a245b1f03c..0000000000 --- a/sdks/full/rust-cli/docs/PortalNotificationsApi.md +++ /dev/null @@ -1,70 +0,0 @@ -# \PortalNotificationsApi - -All URIs are relative to *https://api.rivet.gg* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**portal_notifications_register_notifications**](PortalNotificationsApi.md#portal_notifications_register_notifications) | **POST** /portal/notifications/register | -[**portal_notifications_unregister_notifications**](PortalNotificationsApi.md#portal_notifications_unregister_notifications) | **DELETE** /portal/notifications/register | - - - -## portal_notifications_register_notifications - -> portal_notifications_register_notifications(portal_register_notifications_request) - - -Registers push notifications for the current identity. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**portal_register_notifications_request** | [**PortalRegisterNotificationsRequest**](PortalRegisterNotificationsRequest.md) | | [required] | - -### Return type - - (empty response body) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## portal_notifications_unregister_notifications - -> portal_notifications_unregister_notifications(service) - - -Unregister push notification for the current identity. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**service** | [**PortalNotificationUnregisterService**](.md) | Represents a value for which notification service to unregister. | [required] | - -### Return type - - (empty response body) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/sdks/full/rust-cli/docs/PortalRegisterNotificationsRequest.md b/sdks/full/rust-cli/docs/PortalRegisterNotificationsRequest.md deleted file mode 100644 index 9917ad4267..0000000000 --- a/sdks/full/rust-cli/docs/PortalRegisterNotificationsRequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# PortalRegisterNotificationsRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**service** | [**crate::models::PortalNotificationRegisterService**](PortalNotificationRegisterService.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/sdks/full/rust-cli/src/apis/mod.rs b/sdks/full/rust-cli/src/apis/mod.rs index 174663aba4..0571431e19 100644 --- a/sdks/full/rust-cli/src/apis/mod.rs +++ b/sdks/full/rust-cli/src/apis/mod.rs @@ -127,7 +127,6 @@ pub mod matchmaker_players_api; pub mod matchmaker_regions_api; pub mod module_api; pub mod portal_games_api; -pub mod portal_notifications_api; pub mod provision_datacenters_api; pub mod provision_servers_api; diff --git a/sdks/full/rust-cli/src/apis/portal_notifications_api.rs b/sdks/full/rust-cli/src/apis/portal_notifications_api.rs deleted file mode 100644 index 8264eb28c0..0000000000 --- a/sdks/full/rust-cli/src/apis/portal_notifications_api.rs +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Rivet API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`portal_notifications_register_notifications`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PortalNotificationsRegisterNotificationsError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`portal_notifications_unregister_notifications`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PortalNotificationsUnregisterNotificationsError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - - -/// Registers push notifications for the current identity. -pub async fn portal_notifications_register_notifications(configuration: &configuration::Configuration, portal_register_notifications_request: crate::models::PortalRegisterNotificationsRequest) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/portal/notifications/register", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&portal_register_notifications_request); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Unregister push notification for the current identity. -pub async fn portal_notifications_unregister_notifications(configuration: &configuration::Configuration, service: crate::models::PortalNotificationUnregisterService) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/portal/notifications/register", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - local_var_req_builder = local_var_req_builder.query(&[("service", &service.to_string())]); - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/sdks/full/rust-cli/src/models/mod.rs b/sdks/full/rust-cli/src/models/mod.rs index a618c1f78b..97de6a9ba1 100644 --- a/sdks/full/rust-cli/src/models/mod.rs +++ b/sdks/full/rust-cli/src/models/mod.rs @@ -600,8 +600,6 @@ pub mod portal_notification_register_service; pub use self::portal_notification_register_service::PortalNotificationRegisterService; pub mod portal_notification_unregister_service; pub use self::portal_notification_unregister_service::PortalNotificationUnregisterService; -pub mod portal_register_notifications_request; -pub use self::portal_register_notifications_request::PortalRegisterNotificationsRequest; pub mod provision_datacenters_get_tls_response; pub use self::provision_datacenters_get_tls_response::ProvisionDatacentersGetTlsResponse; pub mod provision_servers_get_info_response; diff --git a/sdks/full/rust-cli/src/models/portal_register_notifications_request.rs b/sdks/full/rust-cli/src/models/portal_register_notifications_request.rs deleted file mode 100644 index 7b15538f9b..0000000000 --- a/sdks/full/rust-cli/src/models/portal_register_notifications_request.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Rivet API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * - * Generated by: https://openapi-generator.tech - */ - - - - -#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] -pub struct PortalRegisterNotificationsRequest { - #[serde(rename = "service")] - pub service: Box, -} - -impl PortalRegisterNotificationsRequest { - pub fn new(service: crate::models::PortalNotificationRegisterService) -> PortalRegisterNotificationsRequest { - PortalRegisterNotificationsRequest { - service: Box::new(service), - } - } -} - - diff --git a/sdks/full/rust/.openapi-generator/FILES b/sdks/full/rust/.openapi-generator/FILES index 738bfabf94..0f27fd894c 100644 --- a/sdks/full/rust/.openapi-generator/FILES +++ b/sdks/full/rust/.openapi-generator/FILES @@ -341,8 +341,6 @@ docs/PortalGetSuggestedGamesResponse.md docs/PortalNotificationRegisterFirebaseService.md docs/PortalNotificationRegisterService.md docs/PortalNotificationUnregisterService.md -docs/PortalNotificationsApi.md -docs/PortalRegisterNotificationsRequest.md docs/ProvisionDatacentersApi.md docs/ProvisionDatacentersGetTlsResponse.md docs/ProvisionServersApi.md @@ -391,7 +389,6 @@ src/apis/matchmaker_regions_api.rs src/apis/mod.rs src/apis/module_api.rs src/apis/portal_games_api.rs -src/apis/portal_notifications_api.rs src/apis/provision_datacenters_api.rs src/apis/provision_servers_api.rs src/lib.rs @@ -697,7 +694,6 @@ src/models/portal_get_suggested_games_response.rs src/models/portal_notification_register_firebase_service.rs src/models/portal_notification_register_service.rs src/models/portal_notification_unregister_service.rs -src/models/portal_register_notifications_request.rs src/models/provision_datacenters_get_tls_response.rs src/models/provision_servers_get_info_response.rs src/models/upload_prepare_file.rs diff --git a/sdks/full/rust/README.md b/sdks/full/rust/README.md index c42a835a13..9da43dcc47 100644 --- a/sdks/full/rust/README.md +++ b/sdks/full/rust/README.md @@ -164,8 +164,6 @@ Class | Method | HTTP request | Description *MatchmakerRegionsApi* | [**matchmaker_regions_list**](docs/MatchmakerRegionsApi.md#matchmaker_regions_list) | **GET** /matchmaker/regions | *ModuleApi* | [**module_call**](docs/ModuleApi.md#module_call) | **POST** /module/modules/{module}/scripts/{script}/call | *PortalGamesApi* | [**portal_games_get_game_profile**](docs/PortalGamesApi.md#portal_games_get_game_profile) | **GET** /portal/games/{game_name_id}/profile | -*PortalNotificationsApi* | [**portal_notifications_register_notifications**](docs/PortalNotificationsApi.md#portal_notifications_register_notifications) | **POST** /portal/notifications/register | -*PortalNotificationsApi* | [**portal_notifications_unregister_notifications**](docs/PortalNotificationsApi.md#portal_notifications_unregister_notifications) | **DELETE** /portal/notifications/register | *ProvisionDatacentersApi* | [**provision_datacenters_get_tls**](docs/ProvisionDatacentersApi.md#provision_datacenters_get_tls) | **GET** /datacenters/{datacenter_id}/tls | *ProvisionServersApi* | [**provision_servers_get_info**](docs/ProvisionServersApi.md#provision_servers_get_info) | **GET** /servers/{ip} | @@ -473,7 +471,6 @@ Class | Method | HTTP request | Description - [PortalNotificationRegisterFirebaseService](docs/PortalNotificationRegisterFirebaseService.md) - [PortalNotificationRegisterService](docs/PortalNotificationRegisterService.md) - [PortalNotificationUnregisterService](docs/PortalNotificationUnregisterService.md) - - [PortalRegisterNotificationsRequest](docs/PortalRegisterNotificationsRequest.md) - [ProvisionDatacentersGetTlsResponse](docs/ProvisionDatacentersGetTlsResponse.md) - [ProvisionServersGetInfoResponse](docs/ProvisionServersGetInfoResponse.md) - [UploadPrepareFile](docs/UploadPrepareFile.md) diff --git a/sdks/full/rust/docs/PortalNotificationsApi.md b/sdks/full/rust/docs/PortalNotificationsApi.md deleted file mode 100644 index a245b1f03c..0000000000 --- a/sdks/full/rust/docs/PortalNotificationsApi.md +++ /dev/null @@ -1,70 +0,0 @@ -# \PortalNotificationsApi - -All URIs are relative to *https://api.rivet.gg* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**portal_notifications_register_notifications**](PortalNotificationsApi.md#portal_notifications_register_notifications) | **POST** /portal/notifications/register | -[**portal_notifications_unregister_notifications**](PortalNotificationsApi.md#portal_notifications_unregister_notifications) | **DELETE** /portal/notifications/register | - - - -## portal_notifications_register_notifications - -> portal_notifications_register_notifications(portal_register_notifications_request) - - -Registers push notifications for the current identity. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**portal_register_notifications_request** | [**PortalRegisterNotificationsRequest**](PortalRegisterNotificationsRequest.md) | | [required] | - -### Return type - - (empty response body) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## portal_notifications_unregister_notifications - -> portal_notifications_unregister_notifications(service) - - -Unregister push notification for the current identity. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**service** | [**PortalNotificationUnregisterService**](.md) | Represents a value for which notification service to unregister. | [required] | - -### Return type - - (empty response body) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/sdks/full/rust/docs/PortalRegisterNotificationsRequest.md b/sdks/full/rust/docs/PortalRegisterNotificationsRequest.md deleted file mode 100644 index 9917ad4267..0000000000 --- a/sdks/full/rust/docs/PortalRegisterNotificationsRequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# PortalRegisterNotificationsRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**service** | [**crate::models::PortalNotificationRegisterService**](PortalNotificationRegisterService.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/sdks/full/rust/src/apis/mod.rs b/sdks/full/rust/src/apis/mod.rs index 174663aba4..0571431e19 100644 --- a/sdks/full/rust/src/apis/mod.rs +++ b/sdks/full/rust/src/apis/mod.rs @@ -127,7 +127,6 @@ pub mod matchmaker_players_api; pub mod matchmaker_regions_api; pub mod module_api; pub mod portal_games_api; -pub mod portal_notifications_api; pub mod provision_datacenters_api; pub mod provision_servers_api; diff --git a/sdks/full/rust/src/apis/portal_notifications_api.rs b/sdks/full/rust/src/apis/portal_notifications_api.rs deleted file mode 100644 index 8264eb28c0..0000000000 --- a/sdks/full/rust/src/apis/portal_notifications_api.rs +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Rivet API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`portal_notifications_register_notifications`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PortalNotificationsRegisterNotificationsError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`portal_notifications_unregister_notifications`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PortalNotificationsUnregisterNotificationsError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - - -/// Registers push notifications for the current identity. -pub async fn portal_notifications_register_notifications(configuration: &configuration::Configuration, portal_register_notifications_request: crate::models::PortalRegisterNotificationsRequest) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/portal/notifications/register", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&portal_register_notifications_request); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Unregister push notification for the current identity. -pub async fn portal_notifications_unregister_notifications(configuration: &configuration::Configuration, service: crate::models::PortalNotificationUnregisterService) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/portal/notifications/register", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - local_var_req_builder = local_var_req_builder.query(&[("service", &service.to_string())]); - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/sdks/full/rust/src/models/mod.rs b/sdks/full/rust/src/models/mod.rs index a618c1f78b..97de6a9ba1 100644 --- a/sdks/full/rust/src/models/mod.rs +++ b/sdks/full/rust/src/models/mod.rs @@ -600,8 +600,6 @@ pub mod portal_notification_register_service; pub use self::portal_notification_register_service::PortalNotificationRegisterService; pub mod portal_notification_unregister_service; pub use self::portal_notification_unregister_service::PortalNotificationUnregisterService; -pub mod portal_register_notifications_request; -pub use self::portal_register_notifications_request::PortalRegisterNotificationsRequest; pub mod provision_datacenters_get_tls_response; pub use self::provision_datacenters_get_tls_response::ProvisionDatacentersGetTlsResponse; pub mod provision_servers_get_info_response; diff --git a/sdks/full/rust/src/models/portal_register_notifications_request.rs b/sdks/full/rust/src/models/portal_register_notifications_request.rs deleted file mode 100644 index 7b15538f9b..0000000000 --- a/sdks/full/rust/src/models/portal_register_notifications_request.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Rivet API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * - * Generated by: https://openapi-generator.tech - */ - - - - -#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] -pub struct PortalRegisterNotificationsRequest { - #[serde(rename = "service")] - pub service: Box, -} - -impl PortalRegisterNotificationsRequest { - pub fn new(service: crate::models::PortalNotificationRegisterService) -> PortalRegisterNotificationsRequest { - PortalRegisterNotificationsRequest { - service: Box::new(service), - } - } -} - - diff --git a/sdks/full/typescript/archive.tgz b/sdks/full/typescript/archive.tgz index 9b967c22a2..4f970e9f07 100644 --- a/sdks/full/typescript/archive.tgz +++ b/sdks/full/typescript/archive.tgz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a4714f8436c9f7cd86215cfa018475d63f0d7636c8a84e43e96afb447355848 -size 636947 +oid sha256:ecb7adccd7053ab1c33db6b63480cab804a768121b43ea2f0021bcacd53b663f +size 635864 diff --git a/sdks/full/typescript/src/api/resources/portal/client/Client.ts b/sdks/full/typescript/src/api/resources/portal/client/Client.ts index 8e57beb39a..78fd3ddee3 100644 --- a/sdks/full/typescript/src/api/resources/portal/client/Client.ts +++ b/sdks/full/typescript/src/api/resources/portal/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import { Games } from "../resources/games/client/Client"; -import { Notifications } from "../resources/notifications/client/Client"; export declare namespace Portal { interface Options { @@ -28,10 +27,4 @@ export class Portal { public get games(): Games { return (this._games ??= new Games(this._options)); } - - protected _notifications: Notifications | undefined; - - public get notifications(): Notifications { - return (this._notifications ??= new Notifications(this._options)); - } } diff --git a/sdks/full/typescript/src/api/resources/portal/resources/index.ts b/sdks/full/typescript/src/api/resources/portal/resources/index.ts index 99de59339d..2c8a5a0a6a 100644 --- a/sdks/full/typescript/src/api/resources/portal/resources/index.ts +++ b/sdks/full/typescript/src/api/resources/portal/resources/index.ts @@ -2,7 +2,4 @@ export * as common from "./common"; export * from "./common/types"; export * as games from "./games"; export * from "./games/types"; -export * as notifications from "./notifications"; -export * from "./notifications/types"; export * from "./games/client/requests"; -export * from "./notifications/client/requests"; diff --git a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/Client.ts b/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/Client.ts deleted file mode 100644 index 0b19d1ccf0..0000000000 --- a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/Client.ts +++ /dev/null @@ -1,273 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as environments from "../../../../../../environments"; -import * as core from "../../../../../../core"; -import * as Rivet from "../../../../.."; -import * as serializers from "../../../../../../serialization"; -import urlJoin from "url-join"; -import * as errors from "../../../../../../errors"; - -export declare namespace Notifications { - interface Options { - environment?: core.Supplier; - token?: core.Supplier; - fetcher?: core.FetchFunction; - } - - interface RequestOptions { - timeoutInSeconds?: number; - maxRetries?: number; - } -} - -export class Notifications { - constructor(protected readonly _options: Notifications.Options = {}) {} - - /** - * Registers push notifications for the current identity. - * @throws {@link Rivet.InternalError} - * @throws {@link Rivet.RateLimitError} - * @throws {@link Rivet.ForbiddenError} - * @throws {@link Rivet.UnauthorizedError} - * @throws {@link Rivet.NotFoundError} - * @throws {@link Rivet.BadRequestError} - */ - public async registerNotifications( - request: Rivet.portal.RegisterNotificationsRequest, - requestOptions?: Notifications.RequestOptions - ): Promise { - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - "/portal/notifications/register" - ), - method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - }, - contentType: "application/json", - body: await serializers.portal.RegisterNotificationsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 180000, - maxRetries: requestOptions?.maxRetries, - }); - if (_response.ok) { - return; - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 500: - throw new Rivet.InternalError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 429: - throw new Rivet.RateLimitError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Rivet.ForbiddenError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 408: - throw new Rivet.UnauthorizedError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Rivet.NotFoundError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 400: - throw new Rivet.BadRequestError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - default: - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - }); - case "timeout": - throw new errors.RivetTimeoutError(); - case "unknown": - throw new errors.RivetError({ - message: _response.error.errorMessage, - }); - } - } - - /** - * Unregister push notification for the current identity. - * @throws {@link Rivet.InternalError} - * @throws {@link Rivet.RateLimitError} - * @throws {@link Rivet.ForbiddenError} - * @throws {@link Rivet.UnauthorizedError} - * @throws {@link Rivet.NotFoundError} - * @throws {@link Rivet.BadRequestError} - */ - public async unregisterNotifications( - request: Rivet.portal.UnregisterNotificationsRequest, - requestOptions?: Notifications.RequestOptions - ): Promise { - const { service } = request; - const _queryParams: Record = {}; - _queryParams["service"] = service; - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - "/portal/notifications/register" - ), - method: "DELETE", - headers: { - Authorization: await this._getAuthorizationHeader(), - }, - contentType: "application/json", - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 180000, - maxRetries: requestOptions?.maxRetries, - }); - if (_response.ok) { - return; - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 500: - throw new Rivet.InternalError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 429: - throw new Rivet.RateLimitError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Rivet.ForbiddenError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 408: - throw new Rivet.UnauthorizedError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Rivet.NotFoundError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 400: - throw new Rivet.BadRequestError( - await serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - default: - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - }); - case "timeout": - throw new errors.RivetTimeoutError(); - case "unknown": - throw new errors.RivetError({ - message: _response.error.errorMessage, - }); - } - } - - protected async _getAuthorizationHeader() { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; - } -} diff --git a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/index.ts b/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/index.ts deleted file mode 100644 index 415726b7fe..0000000000 --- a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/UnregisterNotificationsRequest.ts b/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/UnregisterNotificationsRequest.ts deleted file mode 100644 index c11cfc49b7..0000000000 --- a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/UnregisterNotificationsRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Rivet from "../../../../../.."; - -export interface UnregisterNotificationsRequest { - /** - * Represents a value for which notification service to unregister. - */ - service: Rivet.portal.NotificationUnregisterService; -} diff --git a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/index.ts b/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/index.ts deleted file mode 100644 index 41e118e728..0000000000 --- a/sdks/full/typescript/src/api/resources/portal/resources/notifications/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UnregisterNotificationsRequest } from "./UnregisterNotificationsRequest"; diff --git a/sdks/full/typescript/src/api/resources/portal/resources/notifications/index.ts b/sdks/full/typescript/src/api/resources/portal/resources/notifications/index.ts deleted file mode 100644 index c9240f83b4..0000000000 --- a/sdks/full/typescript/src/api/resources/portal/resources/notifications/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types"; -export * from "./client"; diff --git a/sdks/full/typescript/src/serialization/resources/portal/resources/index.ts b/sdks/full/typescript/src/serialization/resources/portal/resources/index.ts index 366a94dd8d..901aa86d5a 100644 --- a/sdks/full/typescript/src/serialization/resources/portal/resources/index.ts +++ b/sdks/full/typescript/src/serialization/resources/portal/resources/index.ts @@ -2,5 +2,3 @@ export * as common from "./common"; export * from "./common/types"; export * as games from "./games"; export * from "./games/types"; -export * as notifications from "./notifications"; -export * from "./notifications/types"; diff --git a/sdks/full/typescript/src/serialization/resources/portal/resources/notifications/index.ts b/sdks/full/typescript/src/serialization/resources/portal/resources/notifications/index.ts deleted file mode 100644 index eea524d655..0000000000 --- a/sdks/full/typescript/src/serialization/resources/portal/resources/notifications/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./types"; diff --git a/svc/Cargo.lock b/svc/Cargo.lock index 94684421dd..df50f6f998 100644 --- a/svc/Cargo.lock +++ b/svc/Cargo.lock @@ -817,8 +817,6 @@ dependencies = [ "tracing-subscriber", "url", "user-get", - "user-notification-auth-register", - "user-notification-auth-unregister", "user-team-list", "user-token-create", "uuid", @@ -3165,15 +3163,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "erased-serde" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" -dependencies = [ - "serde", -] - [[package]] name = "errno" version = "0.3.8" @@ -3423,20 +3412,6 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" -[[package]] -name = "fcm" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8d0da8a6bd63bdec888b6d7a87c5698230005c1800823d28ddd5adb6f2550f" -dependencies = [ - "chrono", - "erased-serde", - "log", - "reqwest", - "serde", - "serde_json", -] - [[package]] name = "ff" version = "0.13.0" @@ -5964,7 +5939,6 @@ dependencies = [ "linode-worker", "mm-worker", "module-worker", - "push-notification-worker", "rivet-connection", "rivet-health-checks", "rivet-metrics", @@ -6738,20 +6712,6 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" -[[package]] -name = "push-notification-worker" -version = "0.0.1" -dependencies = [ - "chirp-client", - "chirp-worker", - "fcm", - "rivet-health-checks", - "rivet-metrics", - "rivet-runtime", - "serde", - "user-get", -] - [[package]] name = "quanta" version = "0.12.3" @@ -9908,31 +9868,6 @@ dependencies = [ "user-follow-toggle", ] -[[package]] -name = "user-notification-auth-register" -version = "0.0.1" -dependencies = [ - "chirp-client", - "chirp-worker", - "faker-user", - "prost 0.10.4", - "rivet-operation", - "sqlx", -] - -[[package]] -name = "user-notification-auth-unregister" -version = "0.0.1" -dependencies = [ - "chirp-client", - "chirp-worker", - "faker-user", - "prost 0.10.4", - "rivet-operation", - "sqlx", - "user-notification-auth-register", -] - [[package]] name = "user-pending-delete-toggle" version = "0.0.1" diff --git a/svc/Cargo.toml b/svc/Cargo.toml index 5c2ce3a6e1..d7d1e8705e 100644 --- a/svc/Cargo.toml +++ b/svc/Cargo.toml @@ -203,7 +203,6 @@ members = [ "pkg/nsfw/ops/image-score", "pkg/perf/ops/log-get", "pkg/profanity/ops/check", - "pkg/push-notification/worker", "pkg/region/ops/get", "pkg/region/ops/list", "pkg/region/ops/list-for-game", @@ -251,8 +250,6 @@ members = [ "pkg/user-identity/ops/create", "pkg/user-identity/ops/delete", "pkg/user-identity/ops/get", - "pkg/user-notification-auth/ops/register", - "pkg/user-notification-auth/ops/unregister", "pkg/user-presence/ops/get", "pkg/user-presence/ops/touch", "pkg/user-presence/standalone/gc", diff --git a/svc/api/portal/Cargo.toml b/svc/api/portal/Cargo.toml index fe0f6cc67d..e6d59b3992 100644 --- a/svc/api/portal/Cargo.toml +++ b/svc/api/portal/Cargo.toml @@ -42,8 +42,6 @@ team-get = { path = "../../pkg/team/ops/get" } team-member-count = { path = "../../pkg/team/ops/member-count" } token-revoke = { path = "../../pkg/token/ops/revoke" } user-get = { path = "../../pkg/user/ops/get" } -user-notification-auth-register = { path = "../../pkg/user-notification-auth/ops/register" } -user-notification-auth-unregister = { path = "../../pkg/user-notification-auth/ops/unregister" } user-team-list = { path = "../../pkg/user/ops/team-list" } [dev-dependencies] diff --git a/svc/api/portal/src/route/mod.rs b/svc/api/portal/src/route/mod.rs index 6d8df6efa1..c07f5368ee 100644 --- a/svc/api/portal/src/route/mod.rs +++ b/svc/api/portal/src/route/mod.rs @@ -3,7 +3,6 @@ use hyper::{Body, Request, Response}; use rivet_portal_server::models; mod games; -mod notifications; pub async fn handle( shared_client: chirp_client::SharedClientHandle, @@ -28,15 +27,5 @@ define_router! { "games" / String / "profile": { GET: games::profile(), }, - - // Notifications - "notifications" / "register": { - POST: notifications::register( - body: models::RegisterNotificationsRequest, - ), - DELETE: notifications::unregister( - query: notifications::UnregisterNotificationsQuery, - ), - }, }, } diff --git a/svc/api/portal/src/route/notifications.rs b/svc/api/portal/src/route/notifications.rs deleted file mode 100644 index a4e7368a1f..0000000000 --- a/svc/api/portal/src/route/notifications.rs +++ /dev/null @@ -1,56 +0,0 @@ -use api_helper::ctx::Ctx; -use proto::backend::pkg::*; -use rivet_convert::ApiInto; -use rivet_operation::prelude::*; -use rivet_portal_server::models; -use serde::{Deserialize, Serialize}; - -use crate::auth::Auth; - -// MARK: POST /notifications/register -pub async fn register( - ctx: Ctx, - body: models::RegisterNotificationsRequest, -) -> GlobalResult { - let user_ent = ctx.auth().user(ctx.op_ctx()).await?; - - match body.service { - models::NotificationRegisterService::Firebase(registration) => { - // TODO: Validate access key JWT - ensure!(registration.access_key.len() <= 256, "access key too long"); - - op!([ctx] user_notification_auth_register { - user_id: Some(user_ent.user_id.into()), - registration: Some(user_notification_auth::register::request::Registration::Firebase( - user_notification_auth::register::request::FirebaseRegistration { - access_key: registration.access_key, - }, - )), - }) - .await?; - } - } - - Ok(models::RegisterNotificationsResponse {}) -} - -// MARK: DELETE /notifications/register -#[derive(Debug, Serialize, Deserialize)] -pub struct UnregisterNotificationsQuery { - service: models::NotificationUnregisterService, -} - -pub async fn unregister( - ctx: Ctx, - query: UnregisterNotificationsQuery, -) -> GlobalResult { - let user_ent = ctx.auth().user(ctx.op_ctx()).await?; - - op!([ctx] user_notification_auth_unregister { - user_id: Some(user_ent.user_id.into()), - service: ApiInto::::api_into(query.service) as i32, - }) - .await?; - - Ok(models::UnregisterNotificationsResponse {}) -} diff --git a/svc/pkg/monolith/standalone/worker/Cargo.toml b/svc/pkg/monolith/standalone/worker/Cargo.toml index b0d6e709d5..a475dfa6eb 100644 --- a/svc/pkg/monolith/standalone/worker/Cargo.toml +++ b/svc/pkg/monolith/standalone/worker/Cargo.toml @@ -32,7 +32,6 @@ kv-worker = { path = "../../../kv/worker" } linode-worker = { path = "../../../linode/worker" } mm-worker = { path = "../../../mm/worker" } module-worker = { path = "../../../module/worker" } -push-notification-worker = { path = "../../../push-notification/worker" } team-invite-worker = { path = "../../../team-invite/worker" } team-worker = { path = "../../../team/worker" } upload-worker = { path = "../../../upload/worker" } diff --git a/svc/pkg/monolith/standalone/worker/src/lib.rs b/svc/pkg/monolith/standalone/worker/src/lib.rs index 68a61fe410..ef05786e62 100644 --- a/svc/pkg/monolith/standalone/worker/src/lib.rs +++ b/svc/pkg/monolith/standalone/worker/src/lib.rs @@ -34,7 +34,6 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> { linode_worker, mm_worker, module_worker, - push_notification_worker, team_invite_worker, team_worker, upload_worker, diff --git a/svc/pkg/push-notification/types/msg/create.proto b/svc/pkg/push-notification/types/msg/create.proto deleted file mode 100644 index 038efc512e..0000000000 --- a/svc/pkg/push-notification/types/msg/create.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; - -package rivet.backend.pkg.push_notification.msg.create; - -import "proto/common.proto"; -import "proto/backend/notification.proto"; - -/// name = "msg-push-notification-create" -/// parameters = [ -/// { name = "user_id" } -/// ] -message Message { - reserved 4; - - rivet.common.Uuid user_id = 1; - rivet.common.Uuid thread_id = 2; - rivet.backend.notification.NotificationService service = 5; - optional string tag = 6; -} diff --git a/svc/pkg/push-notification/worker/Cargo.toml b/svc/pkg/push-notification/worker/Cargo.toml deleted file mode 100644 index 1e4289741d..0000000000 --- a/svc/pkg/push-notification/worker/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "push-notification-worker" -version = "0.0.1" -edition = "2021" -authors = ["Rivet Gaming, LLC "] -license = "Apache-2.0" - -[dependencies] -chirp-worker = { path = "../../../../lib/chirp/worker" } -chirp-client = { path = "../../../../lib/chirp/client" } -rivet-health-checks = { path = "../../../../lib/health-checks" } -rivet-metrics = { path = "../../../../lib/metrics" } -rivet-runtime = { path = "../../../../lib/runtime" } -fcm = "0.9.1" -serde = { version = "1.0", features = ["derive"] } - -user-get = { path = "../../user/ops/get" } - -[dev-dependencies] -chirp-worker = { path = "../../../../lib/chirp/worker" } diff --git a/svc/pkg/push-notification/worker/Service.toml b/svc/pkg/push-notification/worker/Service.toml deleted file mode 100644 index 02c6fef752..0000000000 --- a/svc/pkg/push-notification/worker/Service.toml +++ /dev/null @@ -1,10 +0,0 @@ -[service] -name = "push-notification-worker" - -[runtime] -kind = "rust" - -[consumer] - -[databases] -db-user-notification-auth = {} diff --git a/svc/pkg/push-notification/worker/src/lib.rs b/svc/pkg/push-notification/worker/src/lib.rs deleted file mode 100644 index 3719b10aa8..0000000000 --- a/svc/pkg/push-notification/worker/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod workers; diff --git a/svc/pkg/push-notification/worker/src/workers/mod.rs b/svc/pkg/push-notification/worker/src/workers/mod.rs deleted file mode 100644 index 81165228f9..0000000000 --- a/svc/pkg/push-notification/worker/src/workers/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod send; - -chirp_worker::workers![send,]; diff --git a/svc/pkg/push-notification/worker/src/workers/send.rs b/svc/pkg/push-notification/worker/src/workers/send.rs deleted file mode 100644 index 801642162f..0000000000 --- a/svc/pkg/push-notification/worker/src/workers/send.rs +++ /dev/null @@ -1,89 +0,0 @@ -use chirp_worker::prelude::*; -use fcm::Client; -use proto::backend::{self, pkg::*}; -use serde::Serialize; - -const FCM_SERVER_KEY: &str = "AAAAYGT1Pys:APA91bFlpAPLVFqsABrYy-38UZAH6tbbxiaM52FOFQDty3N6Ofwjhy5vv_9GgWer7yytg0OxTzKgxvkrgNKYEWL1CK4kiPCSrAq7eEDVU5mSwPvUB7qraqxjuAPSx-h5eMVeO4KTqIRB"; - -#[derive(Serialize)] -struct NotificationData { - url: String, -} - -#[worker(name = "push-notification-send")] -async fn worker( - ctx: &OperationContext, -) -> GlobalResult<()> { - let user_id = unwrap_ref!(ctx.user_id).as_uuid(); - let _thread_id = unwrap_ref!(ctx.thread_id).as_uuid(); - let service = unwrap!(backend::notification::NotificationService::from_i32( - ctx.service - )); - - match service { - // Send push notification through Firebase - backend::notification::NotificationService::Firebase => { - let row = sql_fetch_optional!( - [ctx, (Option,)] - " - SELECT firebase_access_key - FROM db_user_notification_auth.users - WHERE user_id = $1 - ", - user_id, - ) - .await?; - - // Only send notification if registered for Firebase - if let Some((Some(_firebase_access_key),)) = row { - let _client = Client::new(); - - bail!("todo") - - // match kind { - // backend::chat::message_body::Kind::Text(text) => { - // let mut message_builder = - // MessageBuilder::new(FCM_SERVER_KEY, firebase_access_key.as_str()); - - // let sender_user_id = unwrap_ref!(text.sender_user_id); - // let user_res = op!([ctx] user_get { - // user_ids: vec![*sender_user_id], - // }) - // .await?; - // let user = unwrap!(user_res.users.first()); - - // let thread_id = thread_id.to_string(); - - // let title = user.display_name.to_owned(); - // let body = util::format::truncate_at_code_point( - // &text.body.chars().collect::>(), - // 1024, - // )?; - // let icon = util::route::user_avatar(&user); - // let click_url = format!("/threads/{}", thread_id); - - // let mut notif_builder = NotificationBuilder::new(); - // notif_builder.title(&title); - // notif_builder.body(&body); - // notif_builder.icon(&icon); - // if let Some(tag) = ctx.tag.as_ref() { - // notif_builder.tag(tag); - // } - // notif_builder.color("#151515"); - // notif_builder.click_action(&click_url); - // // notif_builder.sound(); // TODO - // let notification = notif_builder.finalize(); - - // message_builder.notification(notification); - // message_builder.collapse_key(&thread_id); - - // client.send(message_builder.finalize()).await?; - // } - // _ => {} - // } - } - } - } - - Ok(()) -} diff --git a/svc/pkg/push-notification/worker/tests/send.rs b/svc/pkg/push-notification/worker/tests/send.rs deleted file mode 100644 index af1374662d..0000000000 --- a/svc/pkg/push-notification/worker/tests/send.rs +++ /dev/null @@ -1,10 +0,0 @@ -use chirp_worker::prelude::*; - -#[worker_test] -async fn empty(_ctx: TestCtx) { - // let res = op!([ctx] push_notification_send { - - // }) - // .await - // .unwrap(); -} diff --git a/svc/pkg/user-notification-auth/db/user-notification-auth/Service.toml b/svc/pkg/user-notification-auth/db/user-notification-auth/Service.toml deleted file mode 100644 index 0cd90e4d5b..0000000000 --- a/svc/pkg/user-notification-auth/db/user-notification-auth/Service.toml +++ /dev/null @@ -1,7 +0,0 @@ -[service] -name = "db-user-notification-auth" - -[runtime] -kind = "crdb" - -[database] diff --git a/svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.down.sql b/svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.down.sql deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.up.sql b/svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.up.sql deleted file mode 100644 index 6ebe1ea2d0..0000000000 --- a/svc/pkg/user-notification-auth/db/user-notification-auth/migrations/20200101000000_init.up.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE users ( - user_id UUID PRIMARY KEY, - firebase_access_key STRING -); diff --git a/svc/pkg/user-notification-auth/ops/register/Cargo.toml b/svc/pkg/user-notification-auth/ops/register/Cargo.toml deleted file mode 100644 index 0e4859bd11..0000000000 --- a/svc/pkg/user-notification-auth/ops/register/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "user-notification-auth-register" -version = "0.0.1" -edition = "2021" -authors = ["Rivet Gaming, LLC "] -license = "Apache-2.0" - -[dependencies] -rivet-operation = { path = "../../../../../lib/operation/core" } -chirp-client = { path = "../../../../../lib/chirp/client" } -prost = "0.10" - -[dependencies.sqlx] -version = "0.7" -default-features = false - -[dev-dependencies] -chirp-worker = { path = "../../../../../lib/chirp/worker" } - -faker-user = { path = "../../../faker/ops/user" } diff --git a/svc/pkg/user-notification-auth/ops/register/README.md b/svc/pkg/user-notification-auth/ops/register/README.md deleted file mode 100644 index 56db3a33d7..0000000000 --- a/svc/pkg/user-notification-auth/ops/register/README.md +++ /dev/null @@ -1 +0,0 @@ -# user-notification-auth-register diff --git a/svc/pkg/user-notification-auth/ops/register/Service.toml b/svc/pkg/user-notification-auth/ops/register/Service.toml deleted file mode 100644 index e3ea6bd296..0000000000 --- a/svc/pkg/user-notification-auth/ops/register/Service.toml +++ /dev/null @@ -1,10 +0,0 @@ -[service] -name = "user-notification-auth-register" - -[runtime] -kind = "rust" - -[operation] - -[databases] -db-user-notification-auth = {} diff --git a/svc/pkg/user-notification-auth/ops/register/src/lib.rs b/svc/pkg/user-notification-auth/ops/register/src/lib.rs deleted file mode 100644 index 5c81b8a80e..0000000000 --- a/svc/pkg/user-notification-auth/ops/register/src/lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -use proto::backend::pkg::*; -use rivet_operation::prelude::*; - -#[operation(name = "user-notification-auth-register")] -async fn handle( - ctx: OperationContext, -) -> GlobalResult { - let user_id = unwrap_ref!(ctx.user_id).as_uuid(); - - match unwrap_ref!(ctx.registration) { - user_notification_auth::register::request::Registration::Firebase(registration) => { - sql_execute!( - [ctx] - "UPSERT INTO db_user_notification_auth.users (user_id, firebase_access_key) VALUES ($1, $2)", - user_id, - registration.access_key.clone(), - ) - .await?; - } - } - - Ok(user_notification_auth::register::Response {}) -} diff --git a/svc/pkg/user-notification-auth/ops/register/tests/integration.rs b/svc/pkg/user-notification-auth/ops/register/tests/integration.rs deleted file mode 100644 index d21a24765e..0000000000 --- a/svc/pkg/user-notification-auth/ops/register/tests/integration.rs +++ /dev/null @@ -1,35 +0,0 @@ -use chirp_worker::prelude::*; -use proto::backend::pkg::*; - -#[worker_test] -async fn empty(ctx: TestCtx) { - let user_res = op!([ctx] faker_user {}).await.unwrap(); - let user_id = user_res.user_id.unwrap(); - - op!([ctx] user_notification_auth_register { - user_id: Some(user_id), - registration: Some(user_notification_auth::register::request::Registration::Firebase( - user_notification_auth::register::request::FirebaseRegistration { - access_key: "--".to_owned(), - }, - )), - }) - .await - .unwrap(); - - let (exists,) = sqlx::query_as::<_, (bool,)>(indoc!( - " - SELECT EXISTS ( - SELECT firebase_access_key - FROM db_user_notification_auth.users - WHERE user_id = $1 - ) - " - )) - .bind(user_id.as_uuid()) - .fetch_one(&ctx.crdb().await.unwrap()) - .await - .unwrap(); - - assert!(exists); -} diff --git a/svc/pkg/user-notification-auth/ops/unregister/Cargo.toml b/svc/pkg/user-notification-auth/ops/unregister/Cargo.toml deleted file mode 100644 index 24a93fa807..0000000000 --- a/svc/pkg/user-notification-auth/ops/unregister/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "user-notification-auth-unregister" -version = "0.0.1" -edition = "2021" -authors = ["Rivet Gaming, LLC "] -license = "Apache-2.0" - -[dependencies] -rivet-operation = { path = "../../../../../lib/operation/core" } -chirp-client = { path = "../../../../../lib/chirp/client" } -prost = "0.10" - -[dependencies.sqlx] -version = "0.7" -default-features = false - -[dev-dependencies] -chirp-worker = { path = "../../../../../lib/chirp/worker" } - -faker-user = { path = "../../../faker/ops/user" } -user-notification-auth-register = { path = "../register" } diff --git a/svc/pkg/user-notification-auth/ops/unregister/README.md b/svc/pkg/user-notification-auth/ops/unregister/README.md deleted file mode 100644 index 32a00a29ab..0000000000 --- a/svc/pkg/user-notification-auth/ops/unregister/README.md +++ /dev/null @@ -1 +0,0 @@ -# user-notification-auth-unregister diff --git a/svc/pkg/user-notification-auth/ops/unregister/Service.toml b/svc/pkg/user-notification-auth/ops/unregister/Service.toml deleted file mode 100644 index acdaaf6715..0000000000 --- a/svc/pkg/user-notification-auth/ops/unregister/Service.toml +++ /dev/null @@ -1,10 +0,0 @@ -[service] -name = "user-notification-auth-unregister" - -[runtime] -kind = "rust" - -[operation] - -[databases] -db-user-notification-auth = {} diff --git a/svc/pkg/user-notification-auth/ops/unregister/src/lib.rs b/svc/pkg/user-notification-auth/ops/unregister/src/lib.rs deleted file mode 100644 index 9dfea331e1..0000000000 --- a/svc/pkg/user-notification-auth/ops/unregister/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -use proto::backend::pkg::*; -use rivet_operation::prelude::*; - -#[operation(name = "user-notification-auth-unregister")] -async fn handle( - ctx: OperationContext, -) -> GlobalResult { - let user_id = unwrap_ref!(ctx.user_id).as_uuid(); - - match unwrap!(user_notification_auth::unregister::request::Service::from_i32(ctx.service)) { - user_notification_auth::unregister::request::Service::Firebase => { - sql_execute!( - [ctx] - "DELETE FROM db_user_notification_auth.users WHERE user_id = $1", - user_id, - ) - .await?; - } - } - - Ok(user_notification_auth::unregister::Response {}) -} diff --git a/svc/pkg/user-notification-auth/ops/unregister/tests/integration.rs b/svc/pkg/user-notification-auth/ops/unregister/tests/integration.rs deleted file mode 100644 index 3d2b2cd385..0000000000 --- a/svc/pkg/user-notification-auth/ops/unregister/tests/integration.rs +++ /dev/null @@ -1,58 +0,0 @@ -use chirp_worker::prelude::*; -use proto::backend::pkg::*; - -#[worker_test] -async fn empty(ctx: TestCtx) { - let user_res = op!([ctx] faker_user {}).await.unwrap(); - let user_id = user_res.user_id.unwrap(); - - op!([ctx] user_notification_auth_register { - user_id: Some(user_id), - registration: Some(user_notification_auth::register::request::Registration::Firebase( - user_notification_auth::register::request::FirebaseRegistration { - access_key: "--".to_owned(), - }, - )), - }) - .await - .unwrap(); - - let (exists,) = sqlx::query_as::<_, (bool,)>(indoc!( - " - SELECT EXISTS ( - SELECT firebase_access_key - FROM db_user_notification_auth.users - WHERE user_id = $1 - ) - " - )) - .bind(user_id.as_uuid()) - .fetch_one(&ctx.crdb().await.unwrap()) - .await - .unwrap(); - - assert!(exists); - - op!([ctx] user_notification_auth_unregister { - user_id: Some(user_id), - service: user_notification_auth::unregister::request::Service::Firebase as i32, - }) - .await - .unwrap(); - - let (exists,) = sqlx::query_as::<_, (bool,)>(indoc!( - " - SELECT EXISTS ( - SELECT firebase_access_key - FROM db_user_notification_auth.users - WHERE user_id = $1 - ) - " - )) - .bind(user_id.as_uuid()) - .fetch_one(&ctx.crdb().await.unwrap()) - .await - .unwrap(); - - assert!(!exists); -} diff --git a/svc/pkg/user-notification-auth/types/register.proto b/svc/pkg/user-notification-auth/types/register.proto deleted file mode 100644 index b3a742cb97..0000000000 --- a/svc/pkg/user-notification-auth/types/register.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; - -package rivet.backend.pkg.user_notification_auth.register; - -import "proto/common.proto"; - -message Request { - message FirebaseRegistration { - string access_key = 1; - } - - rivet.common.Uuid user_id = 1; - - oneof registration { - FirebaseRegistration firebase = 2; - } -} - -message Response { - -} diff --git a/svc/pkg/user-notification-auth/types/unregister.proto b/svc/pkg/user-notification-auth/types/unregister.proto deleted file mode 100644 index 3a19df0f4a..0000000000 --- a/svc/pkg/user-notification-auth/types/unregister.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package rivet.backend.pkg.user_notification_auth.unregister; - -import "proto/common.proto"; - -message Request { - enum Service { - FIREBASE = 0; - } - - rivet.common.Uuid user_id = 1; - Service service = 2; -} - -message Response { - -}