LootBoxesAPI
| Method | HTTP request | Description |
|---|---|---|
| createLootbox | POST /lootboxes | Create a new lootbox |
| deleteLootbox | DELETE /lootboxes/{id} | Delete a lootbox |
| listLootboxes | GET /lootboxes | Fetch lootboxes |
| openLootbox | POST /lootboxes/{id}/open | Open lootbox |
| showLootbox | GET /lootboxes/{id} | Show information about lootbox |
| updateLootbox | PATCH /lootboxes/{id} | Update a lootbox |
createLootbox#
Create a new lootbox
NOTE: user should have scope AdminLootBoxWrite
Request with Combine's publisher:#
public func createLootboxPublisher(body: AdminNewLootBoxBody) -> AnyPublisher<PublicLootBox, APIError>Example:#
import YatLib
let body = AdminNewLootBoxBody(status: "status_example", yats: ["yats_example"], ownerEmail: "ownerEmail_example", ownerId: 123) // AdminNewLootBoxBody | var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.createLootboxPublisher(body: body) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func createLootbox(body: AdminNewLootBoxBody, result: @escaping (Result<PublicLootBox, APIError>) -> Void)Example#
import YatLib
let body = AdminNewLootBoxBody(status: "status_example", yats: ["yats_example"], ownerEmail: "ownerEmail_example", ownerId: 123) // AdminNewLootBoxBody |
Yat.api.lootBoxes.createLootbox(body: AdminNewLootBoxBody { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| body | AdminNewLootBoxBody |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]
deleteLootbox#
Delete a lootbox
NOTE: user should have scope AdminLootBoxWrite
Request with Combine's publisher:#
public func deleteLootboxPublisher(id: UUID) -> AnyPublisher<PublicLootBox, APIError>Example:#
import YatLib
let id = 987 // UUID | var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.deleteLootboxPublisher(id: id) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func deleteLootbox(id: UUID, result: @escaping (Result<PublicLootBox, APIError>) -> Void)Example#
import YatLib
let id = 987 // UUID |
Yat.api.lootBoxes.deleteLootbox(id: UUID { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| id | UUID |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]
listLootboxes#
Fetch lootboxes
Return lootboxes with their usage and availability information NOTE: user should have scope LootBoxAdmin or LootBoxUse
Request with Combine's publisher:#
public func listLootboxesPublisher(dir: String?, limit: Int?, ownerId: UUID?, page: Int?, sort: String?, status: String?) -> AnyPublisher<ListOfPublicLootBox, APIError>Example:#
import YatLib
let dir = "dir_example" // String | (optional)let limit = 987 // Int | (optional)let ownerId = 987 // UUID | Search by LootBox owner (optional)let page = 987 // Int | (optional)let sort = "sort_example" // String | (optional)let status = "status_example" // String | Search for LootBoxes by status (optional)var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.listLootboxesPublisher(dir: dir, limit: limit, ownerId: ownerId, page: page, sort: sort, status: status) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func listLootboxes(dir: String?, limit: Int?, ownerId: UUID?, page: Int?, sort: String?, status: String?, result: @escaping (Result<ListOfPublicLootBox, APIError>) -> Void)Example#
import YatLib
let dir = "dir_example" // String | (optional)let limit = 987 // Int | (optional)let ownerId = 987 // UUID | Search by LootBox owner (optional)let page = 987 // Int | (optional)let sort = "sort_example" // String | (optional)let status = "status_example" // String | Search for LootBoxes by status (optional)
Yat.api.lootBoxes.listLootboxes(dir: String?, limit: Int?, ownerId: UUID?, page: Int?, sort: String?, status: String? { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| dir | String | [optional] | |
| limit | Int | [optional] | |
| ownerId | UUID | Search by LootBox owner | [optional] |
| page | Int | [optional] | |
| sort | String | [optional] | |
| status | String | Search for LootBoxes by status | [optional] |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]
openLootbox#
Open lootbox
Will reassign all yats to user and return full lootbox view NOTE: user should have scope LootBoxUse
Request with Combine's publisher:#
public func openLootboxPublisher(id: UUID) -> AnyPublisher<PublicLootBox, APIError>Example:#
import YatLib
let id = 987 // UUID | var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.openLootboxPublisher(id: id) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func openLootbox(id: UUID, result: @escaping (Result<PublicLootBox, APIError>) -> Void)Example#
import YatLib
let id = 987 // UUID |
Yat.api.lootBoxes.openLootbox(id: UUID { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| id | UUID |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]
showLootbox#
Show information about lootbox
For admin it will show full lootbox information including yats For user only lootbox owned by user, yats stripped NOTE: user should have scope AdminLootBoxRead or LootBoxUse
Request with Combine's publisher:#
public func showLootboxPublisher(id: UUID) -> AnyPublisher<PublicLootBox, APIError>Example:#
import YatLib
let id = 987 // UUID | var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.showLootboxPublisher(id: id) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func showLootbox(id: UUID, result: @escaping (Result<PublicLootBox, APIError>) -> Void)Example#
import YatLib
let id = 987 // UUID |
Yat.api.lootBoxes.showLootbox(id: UUID { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| id | UUID |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]
updateLootbox#
Update a lootbox
NOTE: user should have scope AdminLootBoxWrite
Request with Combine's publisher:#
public func updateLootboxPublisher(id: UUID, body: AdminUpdateLootBoxBody) -> AnyPublisher<PublicLootBox, APIError>Example:#
import YatLib
let id = 987 // UUID | let body = AdminUpdateLootBoxBody(ownerEmail: "ownerEmail_example", ownerId: 123, status: "status_example", yats: ["yats_example"]) // AdminUpdateLootBoxBody | var cancelables = Set<AnyCancellable>()
Yat.api.lootBoxes.updateLootboxPublisher(id: id, body: body) .sink( receiveCompletion: { [weak self] in /* Handle completion/failure */ }, receiveValue: { /* Handle response */ } ) .store(in: &cancelables)Request with closure:#
public func updateLootbox(id: UUID, body: AdminUpdateLootBoxBody, result: @escaping (Result<PublicLootBox, APIError>) -> Void)Example#
import YatLib
let id = 987 // UUID | let body = AdminUpdateLootBoxBody(ownerEmail: "ownerEmail_example", ownerId: 123, status: "status_example", yats: ["yats_example"]) // AdminUpdateLootBoxBody |
Yat.api.lootBoxes.updateLootbox(id: UUID, body: AdminUpdateLootBoxBody { result in switch result { case let .success(model): // Handle response case let .failure(error): // Handle failure }}Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| id | UUID | ||
| body | AdminUpdateLootBoxBody |
Return type#
Authorization#
[Back to top] [Back to API list] [Back to Model list] [Back to index]