@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Giftcard API
@base https://apiexamples.vtexcommercestable.com.br/api
@version 1.0
@auth ApiKey X-VTEX-API-AppKey in header | ApiKey X-VTEX-API-AppToken in header | ApiKey VtexIdclientAutCookie in header
@common_fields {Content-Type: str=application/json, Accept: str=application/json}
@endpoints 11
@toc giftcards(11)

@endpoint POST /giftcards
@returns(200) {id: str, redemptionToken: str, redemptionCode: str, balance: num, relationName: str, emissionDate: str, expiringDate: str, caption: str, currencyCode: str, transactions: map{href: str}}

@endpoint GET /giftcards/{giftCardId}
@required {giftCardId: str}
@returns(200) {id: str, redemptionToken: str, redemptionCode: str, balance: num, emissionDate: str, expiringDate: str, currencyCode: str, transactions: map{href: str}}

@endpoint POST /giftcards/_search
@required {cart: map{grandTotal!: int, relationName!: str, redemptionCode!: str, discounts!: int, shipping!: int, taxes!: int, items!: [map], itemsTotal!: int}, client: map{id!: str, email!: str, document!: str}}
@optional {REST-Range: str=resources=0-49}
@returns(200) {items: [map], paging: map{page: int, perPage: int, total: int, pages: int}}

@endpoint GET /giftcards/{giftCardId}/transactions
@required {giftCardId: str}
@returns(200)

@endpoint POST /giftcards/{giftCardId}/transactions
@required {giftCardId: str, operation: str, value: num(decimal), description: str, redemptionToken: str, redemptionCode: str, requestId: str}
@optional {orderInfo: map{orderId: str, sequence: int, cart: map, clientProfile: map, shipping: map}}
@returns(200) {id: str, _self: map{href: str}}

@endpoint GET /giftcards/{giftCardId}/transactions/{transactionId}
@required {giftCardId: str, transactionId: str}
@returns(200) {value: num, description: str, date: str, requestId: str, settlement: map{href: str}, cancellation: map{href: str}, authorization: map{href: str}, operation: str}

@endpoint GET /giftcards/{giftCardId}/transactions/{transactionId}/authorization
@required {giftCardId: str, transactionId: str}
@returns(200) {oid: str, value: num, date: str}

@endpoint GET /giftcards/{giftCardId}/transactions/{transactionId}/cancellations
@required {giftCardId: str, transactionId: str}
@returns(200)

@endpoint POST /giftcards/{giftCardId}/transactions/{transactionId}/cancellations
@required {giftCardId: str, transactionId: str, value: num, requestId: str}
@returns(200) {oid: str, value: num, date: str}

@endpoint GET /giftcards/{giftCardId}/transactions/{transactionId}/settlements
@required {giftCardId: str, transactionId: str}
@returns(200)

@endpoint POST /giftcards/{giftCardId}/transactions/{transactionId}/settlements
@required {giftCardId: str, transactionId: str, value: num, requestId: str}
@returns(200) {oid: str, value: num, date: str}

@end
