diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index e292c3a..4036f93 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -321,35 +321,6 @@ paths: description: The link is seeded; follow with a full-page nav to /oauth2/authorization/esi "401": description: Missing or expired access token - /activity/fetch: - post: - tags: - - activity - summary: Fetch new activities for the authenticated user's characters from the - EVE API - operationId: fetchAllNewActivities - responses: - "200": - description: New activities fetched and stored - /activity/fetch/{characterId}: - post: - tags: - - activity - summary: Fetch new activities for a character from the EVE API - operationId: fetchNewActivitiesForCharacter - parameters: - - name: characterId - in: path - description: Id of the character - required: true - schema: - type: integer - format: int64 - responses: - "200": - description: New activities fetched and stored - "400": - description: No character with this id /activity/consume: post: tags: @@ -397,8 +368,8 @@ paths: summary: Process new activities for the authenticated user's characters operationId: processNewActivities responses: - "200": - description: New activities processed + "202": + description: Processing started in the background /rule-scripts/definitions: get: tags: @@ -858,6 +829,19 @@ paths: type: array items: $ref: "#/components/schemas/CharacterResponse" + /activities/processed: + get: + tags: + - activity + summary: Stream a notification when the user's activity processing completes + operationId: streamProcessing + responses: + "200": + description: SSE stream opened + content: + text/event-stream: + schema: + $ref: "#/components/schemas/SseEmitter" /acquisitions: get: tags: @@ -1808,6 +1792,14 @@ components: required: - quantity - typeId + SseEmitter: + type: object + properties: + timeout: + type: integer + format: int64 + required: + - timeout AcquisitionResponse: type: object description: "A single acquisition of a market type, tracking the remaining\ diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 39fa313..9850233 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -677,6 +677,9 @@ export interface RuleBookResponse { */ 'script': string; } +export interface SseEmitter { + 'timeout': number; +} /** * A transaction: a dated, described group of transfers between ledgers. */ @@ -935,68 +938,6 @@ export const ActivityApiAxiosParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, - /** - * - * @summary Fetch new activities for the authenticated user\'s characters from the EVE API - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - fetchAllNewActivities: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/activity/fetch`; - // 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; - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Fetch new activities for a character from the EVE API - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - fetchNewActivitiesForCharacter: async (characterId: number, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'characterId' is not null or undefined - assertParamExists('fetchNewActivitiesForCharacter', 'characterId', characterId) - const localVarPath = `/activity/fetch/{characterId}` - .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: 'POST', ...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 Process new activities for the authenticated user\'s characters @@ -1017,6 +958,36 @@ export const ActivityApiAxiosParamCreator = function (configuration?: Configurat 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 Stream a notification when the user\'s activity processing completes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + streamProcessing: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/activities/processed`; + // 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/event-stream'; + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -1061,31 +1032,6 @@ export const ActivityApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['ActivityApi.consume']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, - /** - * - * @summary Fetch new activities for the authenticated user\'s characters from the EVE API - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async fetchAllNewActivities(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.fetchAllNewActivities(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ActivityApi.fetchAllNewActivities']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Fetch new activities for a character from the EVE API - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.fetchNewActivitiesForCharacter(characterId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ActivityApi.fetchNewActivitiesForCharacter']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, /** * * @summary Process new activities for the authenticated user\'s characters @@ -1098,6 +1044,18 @@ export const ActivityApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['ActivityApi.processNewActivities']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * + * @summary Stream a notification when the user\'s activity processing completes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async streamProcessing(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.streamProcessing(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ActivityApi.streamProcessing']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, } }; @@ -1127,25 +1085,6 @@ export const ActivityApiFactory = function (configuration?: Configuration, baseP consume(manualActivityRequest: ManualActivityRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.consume(manualActivityRequest, options).then((request) => request(axios, basePath)); }, - /** - * - * @summary Fetch new activities for the authenticated user\'s characters from the EVE API - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - fetchAllNewActivities(options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.fetchAllNewActivities(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Fetch new activities for a character from the EVE API - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.fetchNewActivitiesForCharacter(characterId, options).then((request) => request(axios, basePath)); - }, /** * * @summary Process new activities for the authenticated user\'s characters @@ -1155,6 +1094,15 @@ export const ActivityApiFactory = function (configuration?: Configuration, baseP processNewActivities(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.processNewActivities(options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Stream a notification when the user\'s activity processing completes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + streamProcessing(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.streamProcessing(options).then((request) => request(axios, basePath)); + }, }; }; @@ -1184,27 +1132,6 @@ export class ActivityApi extends BaseAPI { return ActivityApiFp(this.configuration).consume(manualActivityRequest, options).then((request) => request(this.axios, this.basePath)); } - /** - * - * @summary Fetch new activities for the authenticated user\'s characters from the EVE API - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public fetchAllNewActivities(options?: RawAxiosRequestConfig) { - return ActivityApiFp(this.configuration).fetchAllNewActivities(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Fetch new activities for a character from the EVE API - * @param {number} characterId Id of the character - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig) { - return ActivityApiFp(this.configuration).fetchNewActivitiesForCharacter(characterId, options).then((request) => request(this.axios, this.basePath)); - } - /** * * @summary Process new activities for the authenticated user\'s characters @@ -1214,6 +1141,16 @@ export class ActivityApi extends BaseAPI { public processNewActivities(options?: RawAxiosRequestConfig) { return ActivityApiFp(this.configuration).processNewActivities(options).then((request) => request(this.axios, this.basePath)); } + + /** + * + * @summary Stream a notification when the user\'s activity processing completes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public streamProcessing(options?: RawAxiosRequestConfig) { + return ActivityApiFp(this.configuration).streamProcessing(options).then((request) => request(this.axios, this.basePath)); + } } diff --git a/src/pages/ledger/ListLedgers.vue b/src/pages/ledger/ListLedgers.vue index f0939a3..d82ad2e 100644 --- a/src/pages/ledger/ListLedgers.vue +++ b/src/pages/ledger/ListLedgers.vue @@ -12,7 +12,6 @@ const ledgersStore = useLedgersStore(); const editLedgerModal = ref(); const processActivities = async () => { - await activityApi.fetchAllNewActivities(); await activityApi.processNewActivities(); }