From 052a0a5d0385c209970ffcdc705c91ea10980e25 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Thu, 2 Jul 2026 19:28:37 +0200 Subject: [PATCH] feat(#7): Rework rule-book UI for one-rule-book-per-user model --- docs/mammon-api.yml | 476 ++++------- src/generated/mammon/api.ts | 923 +++++++-------------- src/mammon/mammonService.ts | 4 +- src/pages/Rules.vue | 18 - src/pages/rules/EditCharacterRuleBook.vue | 93 --- src/pages/rules/EditRuleBook.vue | 126 ++- src/pages/rules/ListCharacterRuleBooks.vue | 46 - src/pages/rules/ListRuleBooks.vue | 35 - src/routes.ts | 16 +- src/rules/rules.ts | 90 +- 10 files changed, 539 insertions(+), 1288 deletions(-) delete mode 100644 src/pages/Rules.vue delete mode 100644 src/pages/rules/EditCharacterRuleBook.vue delete mode 100644 src/pages/rules/ListCharacterRuleBooks.vue delete mode 100644 src/pages/rules/ListRuleBooks.vue diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index 20b7923..295d05c 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -6,44 +6,28 @@ servers: - url: http://localhost:8080 description: Generated server url paths: - /rule-books/{ruleBookId}: + /rule-book: get: tags: - rule-book - summary: Find a rule book by its id - operationId: findRuleBookById - parameters: - - name: ruleBookId - in: path - description: Id of the rule book - required: true - schema: - type: string - format: uuid + summary: Find the caller's rule book + operationId: findRuleBook responses: "200": - description: The rule book + description: The caller's rule book content: '*/*': schema: $ref: "#/components/schemas/RuleBookResponse" "404": - description: No rule book with this id + description: The caller has no rule book put: tags: - rule-book - summary: Update a rule book + summary: Update the caller's rule book operationId: updateRuleBook - parameters: - - name: ruleBookId - in: path - description: Id of the rule book - required: true - schema: - type: string - format: uuid requestBody: - description: New state of the rule book + description: New state of the caller's rule book content: application/json: schema: @@ -59,29 +43,8 @@ paths: "400": description: |- Returned when: - - the request is invalid (e.g. blank name) - - the rule book is the default rule book, which cannot be modified - delete: - tags: - - rule-book - summary: Delete a rule book - operationId: deleteRuleBook - parameters: - - name: ruleBookId - in: path - description: Id of the rule book - required: true - schema: - type: string - format: uuid - responses: - "204": - description: The rule book was deleted - "400": - description: |- - Returned when: - - the rule book is associated to a character - - the rule book is the default rule book, which cannot be deleted + - a binding references a ledger the caller does not own + - a binding references a ledger that is not a main ledger /ledgers/main/{ledgerId}: put: tags: @@ -152,108 +115,6 @@ paths: - the request is invalid "404": description: No ledger with this id - /characters/{characterId}/rule-book: - get: - tags: - - character-rule-book - summary: Find the rule book assigned to a character - operationId: findCharacterRuleBookByCharacterId - parameters: - - name: characterId - in: path - description: Id of the character - required: true - schema: - type: integer - format: int64 - responses: - "200": - description: The rule book assignment of the character - content: - '*/*': - schema: - $ref: "#/components/schemas/CharacterRuleBookResponse" - "400": - description: Invalid character id - "404": - description: No rule book assigned to this character - put: - tags: - - character-rule-book - summary: Assign a rule book to a character - operationId: setCharacterRuleBookForCharacter - parameters: - - name: characterId - in: path - description: Id of the character - required: true - schema: - type: integer - format: int64 - requestBody: - description: Rule book and ledger bindings to assign - content: - application/json: - schema: - $ref: "#/components/schemas/SetCharacterRuleBookRequest" - required: true - responses: - "200": - description: The rule book assignment of the character - content: - '*/*': - schema: - $ref: "#/components/schemas/CharacterRuleBookResponse" - "400": - description: |- - Returned when: - - the referenced rule book does not exist - - a bound ledger does not exist - - a bound ledger is not a main or system ledger - - a required ledger binding is missing - /rule-books: - get: - tags: - - rule-book - summary: Find all rule books - operationId: findAllRuleBooks - responses: - "200": - description: All rule books - content: - '*/*': - schema: - type: array - items: - $ref: "#/components/schemas/RuleBookResponse" - post: - tags: - - rule-book - summary: Create a rule book - operationId: createRuleBook - requestBody: - description: Rule book to create - content: - application/json: - schema: - $ref: "#/components/schemas/CreateRuleBookRequest" - required: true - responses: - "201": - description: The created rule book - headers: - Location: - description: URL of the created rule book - style: simple - schema: - type: string - format: uri - content: - '*/*': - schema: - $ref: "#/components/schemas/RuleBookResponse" - "400": - description: Invalid request (e.g. blank name) /reprocessing: post: tags: @@ -456,7 +317,8 @@ paths: post: tags: - activity - summary: Fetch all new activities for all characters from the EVE API + summary: Fetch new activities for the authenticated user's characters from the + EVE API operationId: fetchAllNewActivities responses: "200": @@ -484,15 +346,15 @@ paths: post: tags: - activity - summary: Process new activities for all characters with a usable token + summary: Process new activities for the authenticated user's characters operationId: processNewActivities responses: "200": description: New activities processed - /rule-books/script-definitions: + /rule-scripts/definitions: get: tags: - - rule-book + - rule-script summary: Download the TypeScript definitions for the rule script runtime operationId: getScriptDefinitions responses: @@ -829,15 +691,31 @@ paths: - the types parameter is missing - a types value is not a numeric id - the days parameter is not greater than 0 + /market-orders: + get: + tags: + - market-order + summary: List the open market orders across all characters owned by the authenticated + user + operationId: findAllMarketOrders + responses: + "200": + description: The authenticated user's open market orders + content: + '*/*': + schema: + type: array + items: + $ref: "#/components/schemas/MarketOrderResponse" /ledgers: get: tags: - ledger - summary: Find all ledgers + summary: Find all ledgers owned by the authenticated user operationId: findAllLedgers responses: "200": - description: All ledgers + description: The authenticated user's ledgers content: '*/*': schema: @@ -921,32 +799,17 @@ paths: get: tags: - character - summary: Find all characters with a usable token + summary: Find the characters owned by the authenticated user operationId: findAllCharacters responses: "200": - description: All characters with a usable token + description: The authenticated user's characters content: '*/*': schema: type: array items: $ref: "#/components/schemas/CharacterResponse" - /characters/rule-books: - get: - tags: - - character-rule-book - summary: Find the rule books of all characters that have a token - operationId: findAllCharacterRuleBooks - responses: - "200": - description: Rule book assignments of all characters with a token - content: - '*/*': - schema: - type: array - items: - $ref: "#/components/schemas/CharacterRuleBookResponse" /acquisitions: get: tags: @@ -982,69 +845,58 @@ components: schemas: UpdateRuleBookRequest: type: object - description: Request to update an existing rule book; replaces its mutable fields. + description: Request to update the caller's rule book; replaces its mutable + fields. properties: - name: - type: string - description: Rule book name. - example: Trading rules usedForAcquisitions: type: boolean description: Whether this rule book is used to derive acquisitions. example: true - ledgerRefs: - type: array - description: Symbolic ledger references the script writes to; each must - be bound to a ledger per character. - items: + bindings: + type: object + additionalProperties: type: string - example: sales - pattern: "[a-z][a-zA-Z0-9]*" + format: uuid + description: "Ledger references the script writes to, each bound to one\ + \ of the user's ledgers." script: type: string description: The classification script source. example: transfer.to('sales') required: - - ledgerRefs - - name + - bindings - script - usedForAcquisitions RuleBookResponse: type: object - description: "A rule book: a named script that classifies transactions, together\ - \ with the ledger references it expects." + description: "The caller's rule book: a script that classifies transactions,\ + \ together with its ledger bindings." properties: - ruleBookId: + userId: type: string format: uuid - description: Unique rule book identifier. + description: Owning user identifier. example: 3fa85f64-5717-4562-b3fc-2c963f66afa6 - name: - type: string - description: Rule book name. - example: Trading rules usedForAcquisitions: type: boolean description: Whether this rule book is used to derive acquisitions. example: true - ledgerRefs: - type: array - description: Symbolic ledger references the script writes to; each must - be bound to a ledger per character. - items: + bindings: + type: object + additionalProperties: type: string - example: sales - pattern: "[a-z][a-zA-Z0-9]*" + format: uuid + description: "Ledger references the script writes to, each bound to one\ + \ of the user's ledgers." script: type: string description: The classification script source. example: transfer.to('sales') required: - - ledgerRefs - - name - - ruleBookId + - bindings - script - usedForAcquisitions + - userId UpdateMainLedgerRequest: type: object description: Request to update an existing main ledger. @@ -1127,113 +979,6 @@ components: - ledgerId - memberLedgerIds - name - SetCharacterRuleBookRequest: - type: object - description: "Request to assign a rule book to a character, binding each of\ - \ its ledger references to a concrete ledger." - properties: - ruleBookId: - type: string - format: uuid - description: Id of the rule book to assign. - example: 3fa85f64-5717-4562-b3fc-2c963f66afa6 - bindings: - type: object - additionalProperties: - type: string - format: uuid - description: Bindings from each ledger reference name to the ledger id it - resolves to for this character. - example: - sales: 5c1e6f2a-1234-4562-b3fc-2c963f66afa6 - required: - - bindings - - ruleBookId - CharacterResponse: - type: object - description: An EVE Online character. - properties: - characterId: - type: integer - format: int64 - description: EVE character id. - example: 2112625428 - name: - type: string - description: Character name. - example: CCP Falcon - required: - - characterId - - name - CharacterRuleBookResponse: - type: object - description: "A rule book assigned to a character, with the ledger bindings\ - \ that resolve its references." - properties: - character: - $ref: "#/components/schemas/CharacterResponse" - description: The character the rule book is assigned to. - ruleBook: - $ref: "#/components/schemas/RuleBookSummaryResponse" - description: Summary of the assigned rule book. - bindings: - type: object - additionalProperties: - type: string - format: uuid - description: Bindings from each ledger reference name to the ledger id it - resolves to for this character. - example: - sales: 5c1e6f2a-1234-4562-b3fc-2c963f66afa6 - required: - - bindings - - character - - ruleBook - RuleBookSummaryResponse: - type: object - description: "Lightweight reference to a rule book: its id and name only." - properties: - ruleBookId: - type: string - format: uuid - description: Unique rule book identifier. - example: 3fa85f64-5717-4562-b3fc-2c963f66afa6 - name: - type: string - description: Rule book name. - example: Trading rules - required: - - name - - ruleBookId - CreateRuleBookRequest: - type: object - description: Request to create a new rule book. - properties: - name: - type: string - description: Rule book name. - example: Trading rules - usedForAcquisitions: - type: boolean - description: Whether this rule book is used to derive acquisitions. - example: true - ledgerRefs: - type: array - description: Symbolic ledger references the script writes to; each must - be bound to a ledger per character. - items: - type: string - example: sales - pattern: "[a-z][a-zA-Z0-9]*" - script: - type: string - description: The classification script source. - example: transfer.to('sales') - required: - - ledgerRefs - - name - - script - - usedForAcquisitions MarketTypeStackRequest: type: object description: A quantity of a single market type to reprocess. @@ -1373,6 +1118,22 @@ components: required: - memberLedgerIds - name + CharacterResponse: + type: object + description: An EVE Online character. + properties: + characterId: + type: integer + format: int64 + description: EVE character id. + example: 2112625428 + name: + type: string + description: Character name. + example: CCP Falcon + required: + - characterId + - name MeResponse: type: object description: The authenticated user and the characters they own. @@ -1627,6 +1388,101 @@ components: - marketTypeId - orderCount - sell + MarketOrderResponse: + type: object + description: An open market order placed by one of the authenticated user's + characters. + properties: + orderId: + type: integer + format: int64 + description: EVE market order id. + example: 5266893063 + characterId: + type: integer + format: int64 + description: EVE character id that owns the order. + example: 2112625428 + characterName: + type: string + description: Name of the character that owns the order. + example: CCP Falcon + marketTypeId: + type: integer + format: int64 + description: EVE market type (item) id being traded. + example: 34 + locationId: + type: integer + format: int64 + description: Location id (station or structure) the order is placed at. + example: 60003760 + regionId: + type: integer + format: int64 + description: Region id the order resides in. + example: 10000002 + direction: + type: string + description: Trade direction of the order. + enum: + - BUY + - SELL + example: SELL + price: + type: number + description: "Price per unit, in ISK." + example: 5.42 + volumeTotal: + type: integer + format: int64 + description: Total volume the order was created with. + example: 1000000 + volumeRemain: + type: integer + format: int64 + description: Volume still remaining on the order. + example: 750000 + minVolume: + type: integer + format: int32 + description: Minimum volume that must be bought or sold in a single transaction. + example: 1 + range: + type: string + description: "Order range. For buy orders the matching range, for sell orders\ + \ always 'region'." + example: region + duration: + type: integer + format: int32 + description: "Duration of the order, in days." + example: 90 + issued: + type: string + format: date-time + description: When the order was issued. + example: 2026-06-22T05:12:25Z + escrow: + type: number + description: ISK held in escrow for a buy order; null for sell orders. + example: 4065000.0 + required: + - characterId + - characterName + - direction + - duration + - escrow + - issued + - locationId + - marketTypeId + - minVolume + - orderId + - price + - range + - regionId + - volumeRemain + - volumeTotal LedgerResponse: description: "A ledger, either a standalone main ledger or a combined ledger\ \ aggregating others." diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 9035e0b..b59ad67 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -94,23 +94,6 @@ export interface CharacterResponse { */ 'name': string; } -/** - * A rule book assigned to a character, with the ledger bindings that resolve its references. - */ -export interface CharacterRuleBookResponse { - /** - * The character the rule book is assigned to. - */ - 'character': CharacterResponse; - /** - * Summary of the assigned rule book. - */ - 'ruleBook': RuleBookSummaryResponse; - /** - * Bindings from each ledger reference name to the ledger id it resolves to for this character. - */ - 'bindings': { [key: string]: string; }; -} /** * A combined ledger: an aggregate whose balance is the sum of its member ledgers. */ @@ -154,27 +137,6 @@ export interface CreateMainLedgerRequest { */ 'name': string; } -/** - * Request to create a new rule book. - */ -export interface CreateRuleBookRequest { - /** - * Rule book name. - */ - 'name': string; - /** - * Whether this rule book is used to derive acquisitions. - */ - 'usedForAcquisitions': boolean; - /** - * Symbolic ledger references the script writes to; each must be bound to a ledger per character. - */ - 'ledgerRefs': Array; - /** - * The classification script source. - */ - 'script': string; -} /** * Quartile statistics computed over a market type\'s price history. */ @@ -320,6 +282,79 @@ export interface MarketHistoryResponse { */ 'volume': number; } +/** + * An open market order placed by one of the authenticated user\'s characters. + */ +export interface MarketOrderResponse { + /** + * EVE market order id. + */ + 'orderId': number; + /** + * EVE character id that owns the order. + */ + 'characterId': number; + /** + * Name of the character that owns the order. + */ + 'characterName': string; + /** + * EVE market type (item) id being traded. + */ + 'marketTypeId': number; + /** + * Location id (station or structure) the order is placed at. + */ + 'locationId': number; + /** + * Region id the order resides in. + */ + 'regionId': number; + /** + * Trade direction of the order. + */ + 'direction': MarketOrderResponseDirectionEnum; + /** + * Price per unit, in ISK. + */ + 'price': number; + /** + * Total volume the order was created with. + */ + 'volumeTotal': number; + /** + * Volume still remaining on the order. + */ + 'volumeRemain': number; + /** + * Minimum volume that must be bought or sold in a single transaction. + */ + 'minVolume': number; + /** + * Order range. For buy orders the matching range, for sell orders always \'region\'. + */ + 'range': string; + /** + * Duration of the order, in days. + */ + 'duration': number; + /** + * When the order was issued. + */ + 'issued': string; + /** + * ISK held in escrow for a buy order; null for sell orders. + */ + 'escrow': number; +} + +export const MarketOrderResponseDirectionEnum = { + Buy: 'BUY', + Sell: 'SELL', +} as const; + +export type MarketOrderResponseDirectionEnum = typeof MarketOrderResponseDirectionEnum[keyof typeof MarketOrderResponseDirectionEnum]; + /** * Current best buy and sell prices for a market type. */ @@ -540,56 +575,26 @@ export interface ReprocessingResultResponse { 'output': Array; } /** - * A rule book: a named script that classifies transactions, together with the ledger references it expects. + * The caller\'s rule book: a script that classifies transactions, together with its ledger bindings. */ export interface RuleBookResponse { /** - * Unique rule book identifier. + * Owning user identifier. */ - 'ruleBookId': string; - /** - * Rule book name. - */ - 'name': string; + 'userId': string; /** * Whether this rule book is used to derive acquisitions. */ 'usedForAcquisitions': boolean; /** - * Symbolic ledger references the script writes to; each must be bound to a ledger per character. + * Ledger references the script writes to, each bound to one of the user\'s ledgers. */ - 'ledgerRefs': Array; + 'bindings': { [key: string]: string; }; /** * The classification script source. */ 'script': string; } -/** - * Lightweight reference to a rule book: its id and name only. - */ -export interface RuleBookSummaryResponse { - /** - * Unique rule book identifier. - */ - 'ruleBookId': string; - /** - * Rule book name. - */ - 'name': string; -} -/** - * Request to assign a rule book to a character, binding each of its ledger references to a concrete ledger. - */ -export interface SetCharacterRuleBookRequest { - /** - * Id of the rule book to assign. - */ - 'ruleBookId': string; - /** - * Bindings from each ledger reference name to the ledger id it resolves to for this character. - */ - 'bindings': { [key: string]: string; }; -} /** * A transaction: a dated, described group of transfers between ledgers. */ @@ -644,21 +649,17 @@ export interface UpdateMainLedgerRequest { 'name': string; } /** - * Request to update an existing rule book; replaces its mutable fields. + * Request to update the caller\'s rule book; replaces its mutable fields. */ export interface UpdateRuleBookRequest { - /** - * Rule book name. - */ - 'name': string; /** * Whether this rule book is used to derive acquisitions. */ 'usedForAcquisitions': boolean; /** - * Symbolic ledger references the script writes to; each must be bound to a ledger per character. + * Ledger references the script writes to, each bound to one of the user\'s ledgers. */ - 'ledgerRefs': Array; + 'bindings': { [key: string]: string; }; /** * The classification script source. */ @@ -782,7 +783,7 @@ export const ActivityApiAxiosParamCreator = function (configuration?: Configurat return { /** * - * @summary Fetch all new activities for all characters from the EVE API + * @summary Fetch new activities for the authenticated user\'s characters from the EVE API * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -844,7 +845,7 @@ export const ActivityApiAxiosParamCreator = function (configuration?: Configurat }, /** * - * @summary Process new activities for all characters with a usable token + * @summary Process new activities for the authenticated user\'s characters * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -882,7 +883,7 @@ export const ActivityApiFp = function(configuration?: Configuration) { return { /** * - * @summary Fetch all new activities for all characters from the EVE API + * @summary Fetch new activities for the authenticated user\'s characters from the EVE API * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -907,7 +908,7 @@ export const ActivityApiFp = function(configuration?: Configuration) { }, /** * - * @summary Process new activities for all characters with a usable token + * @summary Process new activities for the authenticated user\'s characters * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -928,7 +929,7 @@ export const ActivityApiFactory = function (configuration?: Configuration, baseP return { /** * - * @summary Fetch all new activities for all characters from the EVE API + * @summary Fetch new activities for the authenticated user\'s characters from the EVE API * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -947,7 +948,7 @@ export const ActivityApiFactory = function (configuration?: Configuration, baseP }, /** * - * @summary Process new activities for all characters with a usable token + * @summary Process new activities for the authenticated user\'s characters * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -963,7 +964,7 @@ export const ActivityApiFactory = function (configuration?: Configuration, baseP export class ActivityApi extends BaseAPI { /** * - * @summary Fetch all new activities for all characters from the EVE API + * @summary Fetch new activities for the authenticated user\'s characters from the EVE API * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -984,7 +985,7 @@ export class ActivityApi extends BaseAPI { /** * - * @summary Process new activities for all characters with a usable token + * @summary Process new activities for the authenticated user\'s characters * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1277,7 +1278,7 @@ export const CharacterApiAxiosParamCreator = function (configuration?: Configura return { /** * - * @summary Find all characters with a usable token + * @summary Find the characters owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1316,7 +1317,7 @@ export const CharacterApiFp = function(configuration?: Configuration) { return { /** * - * @summary Find all characters with a usable token + * @summary Find the characters owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1337,7 +1338,7 @@ export const CharacterApiFactory = function (configuration?: Configuration, base return { /** * - * @summary Find all characters with a usable token + * @summary Find the characters owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1353,7 +1354,7 @@ export const CharacterApiFactory = function (configuration?: Configuration, base export class CharacterApi extends BaseAPI { /** * - * @summary Find all characters with a usable token + * @summary Find the characters owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1364,244 +1365,6 @@ export class CharacterApi extends BaseAPI { -/** - * CharacterRuleBookApi - axios parameter creator - */ -export const CharacterRuleBookApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Find the rule books of all characters that have a token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findAllCharacterRuleBooks: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/characters/rule-books`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Find the rule book assigned to a character - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findCharacterRuleBookByCharacterId: async (characterId: number, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'characterId' is not null or undefined - assertParamExists('findCharacterRuleBookByCharacterId', 'characterId', characterId) - const localVarPath = `/characters/{characterId}/rule-book` - .replace('{characterId}', encodeURIComponent(String(characterId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Assign a rule book to a character - * @param {number} characterId Id of the character - * @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest Rule book and ledger bindings to assign - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setCharacterRuleBookForCharacter: async (characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'characterId' is not null or undefined - assertParamExists('setCharacterRuleBookForCharacter', 'characterId', characterId) - // verify required parameter 'setCharacterRuleBookRequest' is not null or undefined - assertParamExists('setCharacterRuleBookForCharacter', 'setCharacterRuleBookRequest', setCharacterRuleBookRequest) - const localVarPath = `/characters/{characterId}/rule-book` - .replace('{characterId}', encodeURIComponent(String(characterId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(setCharacterRuleBookRequest, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * CharacterRuleBookApi - functional programming interface - */ -export const CharacterRuleBookApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = CharacterRuleBookApiAxiosParamCreator(configuration) - return { - /** - * - * @summary Find the rule books of all characters that have a token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async findAllCharacterRuleBooks(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.findAllCharacterRuleBooks(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['CharacterRuleBookApi.findAllCharacterRuleBooks']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Find the rule book assigned to a character - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async findCharacterRuleBookByCharacterId(characterId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.findCharacterRuleBookByCharacterId(characterId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['CharacterRuleBookApi.findCharacterRuleBookByCharacterId']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Assign a rule book to a character - * @param {number} characterId Id of the character - * @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest Rule book and ledger bindings to assign - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async setCharacterRuleBookForCharacter(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.setCharacterRuleBookForCharacter(characterId, setCharacterRuleBookRequest, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['CharacterRuleBookApi.setCharacterRuleBookForCharacter']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * CharacterRuleBookApi - factory interface - */ -export const CharacterRuleBookApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = CharacterRuleBookApiFp(configuration) - return { - /** - * - * @summary Find the rule books of all characters that have a token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findAllCharacterRuleBooks(options?: RawAxiosRequestConfig): AxiosPromise> { - return localVarFp.findAllCharacterRuleBooks(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Find the rule book assigned to a character - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findCharacterRuleBookByCharacterId(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.findCharacterRuleBookByCharacterId(characterId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Assign a rule book to a character - * @param {number} characterId Id of the character - * @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest Rule book and ledger bindings to assign - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setCharacterRuleBookForCharacter(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.setCharacterRuleBookForCharacter(characterId, setCharacterRuleBookRequest, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * CharacterRuleBookApi - object-oriented interface - */ -export class CharacterRuleBookApi extends BaseAPI { - /** - * - * @summary Find the rule books of all characters that have a token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public findAllCharacterRuleBooks(options?: RawAxiosRequestConfig) { - return CharacterRuleBookApiFp(this.configuration).findAllCharacterRuleBooks(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Find the rule book assigned to a character - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public findCharacterRuleBookByCharacterId(characterId: number, options?: RawAxiosRequestConfig) { - return CharacterRuleBookApiFp(this.configuration).findCharacterRuleBookByCharacterId(characterId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Assign a rule book to a character - * @param {number} characterId Id of the character - * @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest Rule book and ledger bindings to assign - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public setCharacterRuleBookForCharacter(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig) { - return CharacterRuleBookApiFp(this.configuration).setCharacterRuleBookForCharacter(characterId, setCharacterRuleBookRequest, options).then((request) => request(this.axios, this.basePath)); - } -} - - - /** * LedgerApi - axios parameter creator */ @@ -1679,7 +1442,7 @@ export const LedgerApiAxiosParamCreator = function (configuration?: Configuratio }, /** * - * @summary Find all ledgers + * @summary Find all ledgers owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1890,7 +1653,7 @@ export const LedgerApiFp = function(configuration?: Configuration) { }, /** * - * @summary Find all ledgers + * @summary Find all ledgers owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1985,7 +1748,7 @@ export const LedgerApiFactory = function (configuration?: Configuration, basePat }, /** * - * @summary Find all ledgers + * @summary Find all ledgers owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -2065,7 +1828,7 @@ export class LedgerApi extends BaseAPI { /** * - * @summary Find all ledgers + * @summary Find all ledgers owned by the authenticated user * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -2853,6 +2616,100 @@ export class MarketApi extends BaseAPI { +/** + * MarketOrderApi - axios parameter creator + */ +export const MarketOrderApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary List the open market orders across all characters owned by the authenticated user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findAllMarketOrders: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/market-orders`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Accept'] = '*/*'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * MarketOrderApi - functional programming interface + */ +export const MarketOrderApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = MarketOrderApiAxiosParamCreator(configuration) + return { + /** + * + * @summary List the open market orders across all characters owned by the authenticated user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findAllMarketOrders(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findAllMarketOrders(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['MarketOrderApi.findAllMarketOrders']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * MarketOrderApi - factory interface + */ +export const MarketOrderApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = MarketOrderApiFp(configuration) + return { + /** + * + * @summary List the open market orders across all characters owned by the authenticated user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findAllMarketOrders(options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.findAllMarketOrders(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * MarketOrderApi - object-oriented interface + */ +export class MarketOrderApi extends BaseAPI { + /** + * + * @summary List the open market orders across all characters owned by the authenticated user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public findAllMarketOrders(options?: RawAxiosRequestConfig) { + return MarketOrderApiFp(this.configuration).findAllMarketOrders(options).then((request) => request(this.axios, this.basePath)); + } +} + + + /** * ReprocessingApi - axios parameter creator */ @@ -3057,80 +2914,12 @@ export const RuleBookApiAxiosParamCreator = function (configuration?: Configurat return { /** * - * @summary Create a rule book - * @param {CreateRuleBookRequest} createRuleBookRequest Rule book to create + * @summary Find the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createRuleBook: async (createRuleBookRequest: CreateRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'createRuleBookRequest' is not null or undefined - assertParamExists('createRuleBook', 'createRuleBookRequest', createRuleBookRequest) - const localVarPath = `/rule-books`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(createRuleBookRequest, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a rule book - * @param {string} ruleBookId Id of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRuleBook: async (ruleBookId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'ruleBookId' is not null or undefined - assertParamExists('deleteRuleBook', 'ruleBookId', ruleBookId) - const localVarPath = `/rule-books/{ruleBookId}` - .replace('{ruleBookId}', encodeURIComponent(String(ruleBookId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Find all rule books - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findAllRuleBooks: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/rule-books`; + findRuleBook: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/rule-book`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3155,83 +2944,15 @@ export const RuleBookApiAxiosParamCreator = function (configuration?: Configurat }, /** * - * @summary Find a rule book by its id - * @param {string} ruleBookId Id of the rule book + * @summary Update the caller\'s rule book + * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findRuleBookById: async (ruleBookId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'ruleBookId' is not null or undefined - assertParamExists('findRuleBookById', 'ruleBookId', ruleBookId) - const localVarPath = `/rule-books/{ruleBookId}` - .replace('{ruleBookId}', encodeURIComponent(String(ruleBookId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Download the TypeScript definitions for the rule script runtime - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getScriptDefinitions: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/rule-books/script-definitions`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = 'text/plain'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update a rule book - * @param {string} ruleBookId Id of the rule book - * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateRuleBook: async (ruleBookId: string, updateRuleBookRequest: UpdateRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'ruleBookId' is not null or undefined - assertParamExists('updateRuleBook', 'ruleBookId', ruleBookId) + updateRuleBook: async (updateRuleBookRequest: UpdateRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'updateRuleBookRequest' is not null or undefined assertParamExists('updateRuleBook', 'updateRuleBookRequest', updateRuleBookRequest) - const localVarPath = `/rule-books/{ruleBookId}` - .replace('{ruleBookId}', encodeURIComponent(String(ruleBookId))); + const localVarPath = `/rule-book`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3267,77 +2988,25 @@ export const RuleBookApiFp = function(configuration?: Configuration) { return { /** * - * @summary Create a rule book - * @param {CreateRuleBookRequest} createRuleBookRequest Rule book to create + * @summary Find the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async createRuleBook(createRuleBookRequest: CreateRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createRuleBook(createRuleBookRequest, options); + async findRuleBook(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findRuleBook(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RuleBookApi.createRuleBook']?.[localVarOperationServerIndex]?.url; + const localVarOperationServerBasePath = operationServerMap['RuleBookApi.findRuleBook']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * - * @summary Delete a rule book - * @param {string} ruleBookId Id of the rule book + * @summary Update the caller\'s rule book + * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteRuleBook(ruleBookId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRuleBook(ruleBookId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RuleBookApi.deleteRuleBook']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Find all rule books - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async findAllRuleBooks(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.findAllRuleBooks(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RuleBookApi.findAllRuleBooks']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Find a rule book by its id - * @param {string} ruleBookId Id of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async findRuleBookById(ruleBookId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.findRuleBookById(ruleBookId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RuleBookApi.findRuleBookById']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Download the TypeScript definitions for the rule script runtime - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getScriptDefinitions(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getScriptDefinitions(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RuleBookApi.getScriptDefinitions']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Update a rule book - * @param {string} ruleBookId Id of the rule book - * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async updateRuleBook(ruleBookId: string, updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.updateRuleBook(ruleBookId, updateRuleBookRequest, options); + async updateRuleBook(updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateRuleBook(updateRuleBookRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['RuleBookApi.updateRuleBook']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); @@ -3353,62 +3022,22 @@ export const RuleBookApiFactory = function (configuration?: Configuration, baseP return { /** * - * @summary Create a rule book - * @param {CreateRuleBookRequest} createRuleBookRequest Rule book to create + * @summary Find the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createRuleBook(createRuleBookRequest: CreateRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.createRuleBook(createRuleBookRequest, options).then((request) => request(axios, basePath)); + findRuleBook(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.findRuleBook(options).then((request) => request(axios, basePath)); }, /** * - * @summary Delete a rule book - * @param {string} ruleBookId Id of the rule book + * @summary Update the caller\'s rule book + * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteRuleBook(ruleBookId: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.deleteRuleBook(ruleBookId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Find all rule books - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findAllRuleBooks(options?: RawAxiosRequestConfig): AxiosPromise> { - return localVarFp.findAllRuleBooks(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Find a rule book by its id - * @param {string} ruleBookId Id of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - findRuleBookById(ruleBookId: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.findRuleBookById(ruleBookId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Download the TypeScript definitions for the rule script runtime - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getScriptDefinitions(options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getScriptDefinitions(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Update a rule book - * @param {string} ruleBookId Id of the rule book - * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateRuleBook(ruleBookId: string, updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.updateRuleBook(ruleBookId, updateRuleBookRequest, options).then((request) => request(axios, basePath)); + updateRuleBook(updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.updateRuleBook(updateRuleBookRequest, options).then((request) => request(axios, basePath)); }, }; }; @@ -3419,47 +3048,109 @@ export const RuleBookApiFactory = function (configuration?: Configuration, baseP export class RuleBookApi extends BaseAPI { /** * - * @summary Create a rule book - * @param {CreateRuleBookRequest} createRuleBookRequest Rule book to create + * @summary Find the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public createRuleBook(createRuleBookRequest: CreateRuleBookRequest, options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).createRuleBook(createRuleBookRequest, options).then((request) => request(this.axios, this.basePath)); + public findRuleBook(options?: RawAxiosRequestConfig) { + return RuleBookApiFp(this.configuration).findRuleBook(options).then((request) => request(this.axios, this.basePath)); } /** * - * @summary Delete a rule book - * @param {string} ruleBookId Id of the rule book + * @summary Update the caller\'s rule book + * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the caller\'s rule book * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public deleteRuleBook(ruleBookId: string, options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).deleteRuleBook(ruleBookId, options).then((request) => request(this.axios, this.basePath)); + public updateRuleBook(updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig) { + return RuleBookApiFp(this.configuration).updateRuleBook(updateRuleBookRequest, options).then((request) => request(this.axios, this.basePath)); } +} - /** - * - * @summary Find all rule books - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public findAllRuleBooks(options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).findAllRuleBooks(options).then((request) => request(this.axios, this.basePath)); + + +/** + * RuleScriptApi - axios parameter creator + */ +export const RuleScriptApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Download the TypeScript definitions for the rule script runtime + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getScriptDefinitions: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/rule-scripts/definitions`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Accept'] = 'text/plain'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, } +}; - /** - * - * @summary Find a rule book by its id - * @param {string} ruleBookId Id of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public findRuleBookById(ruleBookId: string, options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).findRuleBookById(ruleBookId, options).then((request) => request(this.axios, this.basePath)); +/** + * RuleScriptApi - functional programming interface + */ +export const RuleScriptApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = RuleScriptApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Download the TypeScript definitions for the rule script runtime + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getScriptDefinitions(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getScriptDefinitions(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['RuleScriptApi.getScriptDefinitions']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, } +}; +/** + * RuleScriptApi - factory interface + */ +export const RuleScriptApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = RuleScriptApiFp(configuration) + return { + /** + * + * @summary Download the TypeScript definitions for the rule script runtime + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getScriptDefinitions(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getScriptDefinitions(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * RuleScriptApi - object-oriented interface + */ +export class RuleScriptApi extends BaseAPI { /** * * @summary Download the TypeScript definitions for the rule script runtime @@ -3467,19 +3158,7 @@ export class RuleBookApi extends BaseAPI { * @throws {RequiredError} */ public getScriptDefinitions(options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).getScriptDefinitions(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Update a rule book - * @param {string} ruleBookId Id of the rule book - * @param {UpdateRuleBookRequest} updateRuleBookRequest New state of the rule book - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public updateRuleBook(ruleBookId: string, updateRuleBookRequest: UpdateRuleBookRequest, options?: RawAxiosRequestConfig) { - return RuleBookApiFp(this.configuration).updateRuleBook(ruleBookId, updateRuleBookRequest, options).then((request) => request(this.axios, this.basePath)); + return RuleScriptApiFp(this.configuration).getScriptDefinitions(options).then((request) => request(this.axios, this.basePath)); } } diff --git a/src/mammon/mammonService.ts b/src/mammon/mammonService.ts index dd043f1..a5dce62 100644 --- a/src/mammon/mammonService.ts +++ b/src/mammon/mammonService.ts @@ -6,12 +6,12 @@ import { ActivityApi, AuthApi, CharacterApi, - CharacterRuleBookApi, LedgerApi, MarketApi, MeResponse, ReprocessingApi, RuleBookApi, + RuleScriptApi, TransactionApi } from "@/generated/mammon"; @@ -101,7 +101,7 @@ export const ledgerApi = new LedgerApi(undefined, mammonUrl, mammonAxiosInstance export const transactionApi = new TransactionApi(undefined, mammonUrl, mammonAxiosInstance); export const characterApi = new CharacterApi(undefined, mammonUrl, mammonAxiosInstance); export const ruleBookApi = new RuleBookApi(undefined, mammonUrl, mammonAxiosInstance); -export const characterRuleBookApi = new CharacterRuleBookApi(undefined, mammonUrl, mammonAxiosInstance); +export const ruleScriptApi = new RuleScriptApi(undefined, mammonUrl, mammonAxiosInstance); export const activityApi = new ActivityApi(undefined, mammonUrl, mammonAxiosInstance); export const acquisitionApi = new AcquisitionApi(undefined, mammonUrl, mammonAxiosInstance); export const marketApi = new MarketApi(undefined, mammonUrl, mammonAxiosInstance); diff --git a/src/pages/Rules.vue b/src/pages/Rules.vue deleted file mode 100644 index f72f708..0000000 --- a/src/pages/Rules.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - \ No newline at end of file diff --git a/src/pages/rules/EditCharacterRuleBook.vue b/src/pages/rules/EditCharacterRuleBook.vue deleted file mode 100644 index e49edeb..0000000 --- a/src/pages/rules/EditCharacterRuleBook.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - \ No newline at end of file diff --git a/src/pages/rules/EditRuleBook.vue b/src/pages/rules/EditRuleBook.vue index 0a2e161..7ae6407 100644 --- a/src/pages/rules/EditRuleBook.vue +++ b/src/pages/rules/EditRuleBook.vue @@ -1,41 +1,52 @@ \ No newline at end of file + diff --git a/src/pages/rules/ListCharacterRuleBooks.vue b/src/pages/rules/ListCharacterRuleBooks.vue deleted file mode 100644 index 0a0d3fe..0000000 --- a/src/pages/rules/ListCharacterRuleBooks.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - \ No newline at end of file diff --git a/src/pages/rules/ListRuleBooks.vue b/src/pages/rules/ListRuleBooks.vue deleted file mode 100644 index 15fb597..0000000 --- a/src/pages/rules/ListRuleBooks.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - \ No newline at end of file diff --git a/src/routes.ts b/src/routes.ts index 0641046..13e4060 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -12,10 +12,7 @@ export const routeNames = { viewLedger: 'view-ledger', viewLedgerBalance: 'view-ledger-balance', listLedgerTransactions: 'list-ledger-transactions', - listRuleBooks: 'list-rule-books', - newRuleBook: 'new-rule-book', editRuleBook: 'edit-rule-book', - editCharacterRulebook: 'edit-character-rule-book', marketTypes: 'market-types', about: 'about', } as const; @@ -33,18 +30,7 @@ export const routes: RouteRecordRaw[] = [ ]}, ]}, - {path: '/rules', component: () => import('@/pages/Rules.vue'), children: [ - {path: '', redirect: {name: routeNames.listRuleBooks}}, - {path: '/rule-books', children: [ - {path: '', name: routeNames.listRuleBooks, component: () => import('@/pages/rules/ListRuleBooks.vue')}, - {path: 'new', name: routeNames.newRuleBook, component: () => import('@/pages/rules/EditRuleBook.vue')}, - {path: ':ruleBookId', name: routeNames.editRuleBook, component: () => import('@/pages/rules/EditRuleBook.vue')}, - ]}, - {path: '/characters/rules', children: [ - {path: '', component: () => import('@/pages/rules/ListCharacterRuleBooks.vue')}, - {path: '/characters/:characterId/rules', name: routeNames.editCharacterRulebook, component: () => import('@/pages/rules/EditCharacterRuleBook.vue')}, - ]} - ]}, + {path: '/rules', name: routeNames.editRuleBook, component: () => import('@/pages/rules/EditRuleBook.vue')}, {path: '/market', component: () => import('@/pages/Market.vue'), children: [ {path: '', redirect: {name: routeNames.marketTypes}}, diff --git a/src/rules/rules.ts b/src/rules/rules.ts index 6aed82e..10b01b9 100644 --- a/src/rules/rules.ts +++ b/src/rules/rules.ts @@ -1,83 +1,31 @@ -import {characterRuleBookApi, ruleBookApi} from "@/mammon"; -import { - CharacterRuleBookResponse, - CreateRuleBookRequest, - RuleBookResponse, - SetCharacterRuleBookRequest -} from "@/generated/mammon"; +import {ruleBookApi, ruleScriptApi} from "@/mammon"; +import {RuleBookResponse, UpdateRuleBookRequest} from "@/generated/mammon"; +import {isAxiosError} from "axios"; import {defineStore} from "pinia"; -import {ref, triggerRef} from "vue"; +import {ref} from "vue"; export type RuleBook = RuleBookResponse; -export const useRuleBooksStore = defineStore('rule-books', () => { - const ruleBooks = ref([]); +export const useRuleBookStore = defineStore('rule-book', () => { + const ruleBook = ref(null); - const addRuleBook = (ruleBook: RuleBook) => { - ruleBooks.value.push(ruleBook); - triggerRef(ruleBooks); - return ruleBook; - }; + const refresh = () => ruleBookApi.findRuleBook() + .then(response => ruleBook.value = response.data) + .catch(error => { + if (isAxiosError(error) && error.response?.status === 404) { + ruleBook.value = null; + return; + } + throw error; + }); - const replaceRuleBook = (ruleBook: RuleBook) => { - const index = ruleBooks.value.findIndex(rb => rb.ruleBookId === ruleBook.ruleBookId); - - if (index !== -1) { - ruleBooks.value[index] = ruleBook; - } - triggerRef(ruleBooks); - return ruleBook; - }; - - const findById = (ruleBookId: string): RuleBook | undefined => ruleBooks.value.find(rb => rb.ruleBookId === ruleBookId); - const create = (ruleBook: CreateRuleBookRequest) => ruleBookApi.createRuleBook(ruleBook).then(response => addRuleBook(response.data)); - const update = (ruleBookId: string, ruleBook: CreateRuleBookRequest) => ruleBookApi.updateRuleBook(ruleBookId, ruleBook).then(response => replaceRuleBook(response.data)); - const duplicate = (ruleBook: RuleBook) => create({ - name: `${ruleBook.name} (copy)`, - usedForAcquisitions: ruleBook.usedForAcquisitions, - ledgerRefs: [...ruleBook.ledgerRefs], - script: ruleBook.script, - }); - - const remove = (ruleBookId: string) => ruleBookApi.deleteRuleBook(ruleBookId).then(() => { - ruleBooks.value = ruleBooks.value.filter(rb => rb.ruleBookId !== ruleBookId); - }); - - const refresh = () => ruleBookApi.findAllRuleBooks().then(response => ruleBooks.value = response.data); + const update = (request: UpdateRuleBookRequest) => ruleBookApi.updateRuleBook(request) + .then(response => ruleBook.value = response.data); refresh(); - return {ruleBooks, findById, create, update, duplicate, remove, refresh}; -}) - -export type CharacterRuleBook = CharacterRuleBookResponse; - -export const useCharacterRuleBooksStore = defineStore('character-rule-books', () => { - const characterRuleBooks = ref([]); - - const replaceCharacterRuleBook = (characterRuleBook: CharacterRuleBook) => { - const index = characterRuleBooks.value.findIndex(crb => crb.character.characterId === characterRuleBook.character.characterId); - - if (index !== -1) { - characterRuleBooks.value[index] = characterRuleBook; - } else { - characterRuleBooks.value.push(characterRuleBook); - } - triggerRef(characterRuleBooks); - return characterRuleBook; - }; - - const findByCharacterId = (characterId: number): CharacterRuleBook | undefined => characterRuleBooks.value.find(crb => crb.character.characterId === characterId); - - const setForCharacter = (characterId: number, ruleBook: SetCharacterRuleBookRequest) => characterRuleBookApi.setCharacterRuleBookForCharacter(characterId, ruleBook) - .then(response => replaceCharacterRuleBook(response.data)); - - const refresh = () => characterRuleBookApi.findAllCharacterRuleBooks().then(response => characterRuleBooks.value = response.data); - - refresh(); - - return {characterRuleBooks, findByCharacterId, setForCharacter, refresh}; + return {ruleBook, refresh, update}; }) export const fetchScriptDefinitions = (): Promise => - ruleBookApi.getScriptDefinitions({responseType: 'text'}).then(response => response.data); \ No newline at end of file + ruleScriptApi.getScriptDefinitions({responseType: 'text'}).then(response => response.data); \ No newline at end of file