Skip to content

Commit

Permalink
feat: implement rest update and delete segment REST (#1441)
Browse files Browse the repository at this point in the history
Part of #1417

- Implement REST for update and delete segment
- Remove command pattern
- Add e2e test for no command segment API set
  • Loading branch information
hvn2k1 authored and steveninhle committed Jan 17, 2025
1 parent e79fc73 commit 8c9ac26
Show file tree
Hide file tree
Showing 24 changed files with 3,915 additions and 2,055 deletions.
121 changes: 121 additions & 0 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3330,6 +3330,57 @@ paths:
type: string
tags:
- segment
delete:
summary: Delete
description: Delete a segment.
operationId: web.v1.segment.delete
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/featureDeleteSegmentResponse'
"400":
description: Returned for bad requests that may have failed validation.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 3
details: []
message: invalid arguments error
"401":
description: Request could not be authenticated (authentication required).
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 16
details: []
message: not authenticated
"503":
description: Returned for internal errors.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 13
details: []
message: internal
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: id
in: query
required: false
type: string
- name: environmentId
in: query
required: false
type: string
tags:
- segment
post:
summary: Create
description: Create a segment.
Expand Down Expand Up @@ -3378,6 +3429,54 @@ paths:
$ref: '#/definitions/featureCreateSegmentRequest'
tags:
- segment
patch:
summary: Update
description: Update a segment.
operationId: web.v1.segment.update
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/featureUpdateSegmentResponse'
"400":
description: Returned for bad requests that may have failed validation.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 3
details: []
message: invalid arguments error
"401":
description: Request could not be authenticated (authentication required).
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 16
details: []
message: not authenticated
"503":
description: Returned for internal errors.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 13
details: []
message: internal
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/featureUpdateSegmentRequest'
tags:
- segment
/v1/segment_users/bulk_upload:
post:
summary: Bulk upload
Expand Down Expand Up @@ -5976,8 +6075,30 @@ definitions:
type: object
featureUpdateFlagTriggerResponse:
type: object
featureUpdateSegmentRequest:
type: object
properties:
id:
type: string
commands:
type: array
items:
type: object
$ref: '#/definitions/featureCommand'
description: deprecated
environmentId:
type: string
name:
type: string
description:
type: string
required:
- environmentId
featureUpdateSegmentResponse:
type: object
properties:
segment:
$ref: '#/definitions/featureSegment'
featureUserEvaluations:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion manifests/bucketeer/charts/api/values.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions manifests/bucketeer/charts/web/values.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions pkg/domainevent/domain/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,14 @@ func LocalizedMessage(eventType proto.Event_Type, localizer locale.Localizer) *p
localizer.MustLocalizeWithTemplate(locale.Segment),
),
}
case proto.Event_SEGMENT_UPDATED:
return &proto.LocalizedMessage{
Locale: localizer.GetLocale(),
Message: localizer.MustLocalizeWithTemplate(
locale.UpdatedTemplate,
localizer.MustLocalizeWithTemplate(locale.Segment),
),
}
case proto.Event_SEGMENT_NAME_CHANGED:
return &proto.LocalizedMessage{
Locale: localizer.GetLocale(),
Expand Down
Loading

0 comments on commit 8c9ac26

Please sign in to comment.