-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
169 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
allOf: | ||
- $ref: '#/components/schemas/WithdrawalKey' | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
required: | ||
- amount | ||
- address | ||
- created_at | ||
properties: | ||
amount: | ||
type: integer | ||
description: Amount of points withdrawn | ||
example: 580 | ||
address: | ||
type: string | ||
description: Rarimo address which points were withdrawn to. Can be any valid address. | ||
example: rarimo15hcd6tv7pe8hk2re7hu0zg0aphqdm2dtjrs0ds | ||
created_at: | ||
type: integer | ||
description: Unix timestamp of withdrawal creation | ||
example: 1706531218 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: object | ||
required: | ||
- id | ||
- type | ||
properties: | ||
id: | ||
type: string | ||
example: "059c81dd-2a54-44a8-8142-c15ad8f88949" | ||
type: | ||
type: string | ||
enum: [ withdrawal ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
docs/spec/paths/integrations@rarime-points-svc@v1@balances@{did}@withdrawals.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
get: | ||
tags: | ||
- Points balance | ||
summary: Withdrawal history | ||
description: Points withdrawal history of the user | ||
operationId: getWithdrawalHistory | ||
parameters: | ||
- $ref: '#/components/parameters/pathDID' | ||
- $ref: '#/components/parameters/pageCursor' | ||
- $ref: '#/components/parameters/pageLimit' | ||
- $ref: '#/components/parameters/pageOrder' | ||
responses: | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Withdrawal' | ||
400: | ||
$ref: '#/components/responses/invalidParameter' | ||
401: | ||
$ref: '#/components/responses/invalidAuth' | ||
500: | ||
$ref: '#/components/responses/internalError' | ||
|
||
post: | ||
tags: | ||
- Points balance | ||
summary: Withdraw points | ||
description: Convert points to RMO by exchange rate and withdraw to user wallet | ||
operationId: withdrawPoints | ||
parameters: | ||
- $ref: '#/components/parameters/pathDID' | ||
requestBody: | ||
required: true | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/Withdraw' | ||
responses: | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
- included | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/Withdrawal' | ||
included: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Balance' | ||
400: | ||
$ref: '#/components/responses/invalidParameter' | ||
401: | ||
$ref: '#/components/responses/invalidAuth' | ||
500: | ||
$ref: '#/components/responses/internalError' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
import "encoding/json" | ||
|
||
type Withdrawal struct { | ||
Key | ||
Attributes WithdrawalAttributes `json:"attributes"` | ||
} | ||
type WithdrawalResponse struct { | ||
Data Withdrawal `json:"data"` | ||
Included Included `json:"included"` | ||
} | ||
|
||
type WithdrawalListResponse struct { | ||
Data []Withdrawal `json:"data"` | ||
Included Included `json:"included"` | ||
Links *Links `json:"links"` | ||
Meta json.RawMessage `json:"meta,omitempty"` | ||
} | ||
|
||
func (r *WithdrawalListResponse) PutMeta(v interface{}) (err error) { | ||
r.Meta, err = json.Marshal(v) | ||
return err | ||
} | ||
|
||
func (r *WithdrawalListResponse) GetMeta(out interface{}) error { | ||
return json.Unmarshal(r.Meta, out) | ||
} | ||
|
||
// MustWithdrawal - returns Withdrawal from include collection. | ||
// if entry with specified key does not exist - returns nil | ||
// if entry with specified key exists but type or ID mismatches - panics | ||
func (c *Included) MustWithdrawal(key Key) *Withdrawal { | ||
var withdrawal Withdrawal | ||
if c.tryFindEntry(key, &withdrawal) { | ||
return &withdrawal | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
type WithdrawalAttributes struct { | ||
// Rarimo address which points were withdrawn to. Can be any valid address. | ||
Address string `json:"address"` | ||
// Amount of points withdrawn | ||
Amount int32 `json:"amount"` | ||
// Unix timestamp of withdrawal creation | ||
CreatedAt int32 `json:"created_at"` | ||
} |