Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
All Offer APIs#24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
All Offer APIs #24
Changes from all commits
6e9e4ec88cd86e735de764c3e03aa0581a593be75682dc61d92c573b5dc53fcfde053fea3814ef90130c3a2cb74a3dd6fc3ac0fe0f283ff754883390c5a24dd88df384e78162c5de32bbedbb1287230fbFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| $version: "2" | ||
| namespace com.shopping.inandout.offer | ||
| use com.shopping.inandout#ResourceAlreadyExistsError | ||
| use com.shopping.inandout#ResourceNotFoundError | ||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
| resource Offer { | ||
| identifiers: { | ||
| brandSlug: Slug | ||
| offerId: ID | ||
| } | ||
| properties: { | ||
| percentage: Percentage | ||
| storeIdList: UIDList | ||
| articleSlugList: SlugList | ||
| dependencyList: DependencyList | ||
| timeRange: TimeRange | ||
| lifetime: NaturalNumber | ||
| createdAt: Timestamp | ||
| updatedAt: Timestamp | ||
| } | ||
| create: CreateOffer | ||
| read: GetOffer | ||
| list: ListOffers | ||
| update: UpdateOffer | ||
| delete: DeleteOffer | ||
| } | ||
| @http(method: "POST", uri: "/api/brands/{brandSlug}/offers") | ||
| operation CreateOffer { | ||
| input: CreateOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceAlreadyExistsError | ||
| ] | ||
| } | ||
| @readonly | ||
| @http(method: "GET", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| operation GetOffer { | ||
| input: GetOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceNotFoundError | ||
| ] | ||
| } | ||
| @readonly | ||
| @paginated | ||
| @http(method: "GET", uri: "/api/brands/{brandSlug}/offers") | ||
| operation ListOffers { | ||
| input: ListOffersInput | ||
| output: OfferSummaries | ||
| } | ||
| @http(method: "PATCH", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| @documentation("Non-idempotent cascading operation, creates/deletes internal resources as needed") | ||
| operation UpdateOffer { | ||
| input: UpdateOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceNotFoundError | ||
| ] | ||
| } | ||
| @idempotent | ||
| @http(method: "DELETE", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| @documentation("Not restricted cascading operation, deletes discounts, dependencies, etc.") | ||
| operation DeleteOffer { | ||
| input: DeleteOfferInput | ||
| output: OfferSummary | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| $version: "2" | ||
| namespace com.shopping.inandout.offer | ||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#InputPagination | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
| structure CreateOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
| @required | ||
| percentage: Percentage | ||
| storeIdList: UIDList | ||
| @required | ||
| articleSlugList: SlugList | ||
| dependencyList: DependencyList | ||
| timeRange: TimeRange | ||
| @required | ||
| lifetime: NaturalNumber | ||
| } | ||
| structure GetOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
| } | ||
| structure ListOffersInput with [InputPagination] { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dd some queries. offers added today? offer to expire today, tomorrow, in a week? offer to a product? offers in a store? | ||
| } | ||
| structure UpdateOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
| percentage: Percentage | ||
| storeIdList: UIDList | ||
| articleSlugList: SlugList | ||
| dependencyList: DependencyList | ||
| timeRange: TimeRange | ||
| lifetime: NaturalNumber | ||
| } | ||
| structure DeleteOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| $version: "2" | ||
| namespace com.shopping.inandout.offer | ||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#OutputPagination | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
| @documentation("Product dependency; it must be bought in order for the offer to activate.") | ||
| structure Dependency { | ||
| @required | ||
| articleSlug: Slug | ||
| quantity: NaturalNumber | ||
| } | ||
| list DependencyList { | ||
| member: Dependency | ||
| } | ||
| structure OfferSummary { | ||
| @required | ||
| brandSlug: Slug | ||
| @required | ||
| offerId: ID | ||
| @required | ||
| percentage: Percentage | ||
| storeIdList: UIDList | ||
| @required | ||
| articleSlugList: SlugList | ||
| dependencyList: DependencyList | ||
| timeRange: TimeRange | ||
| @required | ||
| lifetime: NaturalNumber | ||
| @required | ||
| createdAt: Timestamp | ||
| @required | ||
| updatedAt: Timestamp | ||
| } | ||
| list OfferSummaryList { | ||
| member: OfferSummary | ||
| } | ||
| structure OfferSummaries with [OutputPagination] { | ||
| tokens: OfferSummaryList | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also 404 error, in case that brandSlug does not exist