Skip to content

Commit

Permalink
Adding pre-load API; added data pull API; fixed tests; regen OpenAPI …
Browse files Browse the repository at this point in the history
…spec; remove a test endpoint

- Pre-load API: a separate API that can be used to load and build a product for a given system and SKU
- Created a function to load the data from Learn for a given system and SKU (but just load it)
- Fixed some test issues
- Removed the traefik_test_request endpoint, since we're not doing Traefik at all now
- Added some settings for throttling
  • Loading branch information
jkachel committed Jan 8, 2025
1 parent deff300 commit 6f02a2c
Show file tree
Hide file tree
Showing 8 changed files with 1,188 additions and 916 deletions.
142 changes: 142 additions & 0 deletions frontends/api/src/generated/v0/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,58 @@ export const MetaApiAxiosParamCreator = function (
options: localVarRequestOptions,
}
},
/**
* Pre-loads the product metadata for a given SKU, even if the SKU doesn\'t exist yet.
* @param {string} sku
* @param {string} system_slug
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
metaProductPreloadRetrieve: async (
sku: string,
system_slug: string,
options: RawAxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'sku' is not null or undefined
assertParamExists("metaProductPreloadRetrieve", "sku", sku)
// verify required parameter 'system_slug' is not null or undefined
assertParamExists(
"metaProductPreloadRetrieve",
"system_slug",
system_slug,
)
const localVarPath = `/api/v0/meta/product/preload/{system_slug}/{sku}/`
.replace(`{${"sku"}}`, encodeURIComponent(String(sku)))
.replace(`{${"system_slug"}}`, encodeURIComponent(String(system_slug)))
// 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

setSearchParams(localVarUrlObj, localVarQueryParameter)
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {}
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
}

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
}
},
/**
* Viewset for Product model.
* @param {number} id A unique integer value identifying this product.
Expand Down Expand Up @@ -3185,6 +3237,37 @@ export const MetaApiFp = function (configuration?: Configuration) {
configuration,
)(axios, operationBasePath || basePath)
},
/**
* Pre-loads the product metadata for a given SKU, even if the SKU doesn\'t exist yet.
* @param {string} sku
* @param {string} system_slug
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async metaProductPreloadRetrieve(
sku: string,
system_slug: string,
options?: RawAxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Product>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.metaProductPreloadRetrieve(
sku,
system_slug,
options,
)
const index = configuration?.serverIndex ?? 0
const operationBasePath =
operationServerMap["MetaApi.metaProductPreloadRetrieve"]?.[index]?.url
return (axios, basePath) =>
createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
)(axios, operationBasePath || basePath)
},
/**
* Viewset for Product model.
* @param {number} id A unique integer value identifying this product.
Expand Down Expand Up @@ -3420,6 +3503,24 @@ export const MetaApiFactory = function (
)
.then((request) => request(axios, basePath))
},
/**
* Pre-loads the product metadata for a given SKU, even if the SKU doesn\'t exist yet.
* @param {MetaApiMetaProductPreloadRetrieveRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
metaProductPreloadRetrieve(
requestParameters: MetaApiMetaProductPreloadRetrieveRequest,
options?: RawAxiosRequestConfig,
): AxiosPromise<Product> {
return localVarFp
.metaProductPreloadRetrieve(
requestParameters.sku,
requestParameters.system_slug,
options,
)
.then((request) => request(axios, basePath))
},
/**
* Viewset for Product model.
* @param {MetaApiMetaProductRetrieveRequest} requestParameters Request parameters.
Expand Down Expand Up @@ -3644,6 +3745,27 @@ export interface MetaApiMetaProductPartialUpdateRequest {
readonly PatchedProductRequest?: PatchedProductRequest
}

/**
* Request parameters for metaProductPreloadRetrieve operation in MetaApi.
* @export
* @interface MetaApiMetaProductPreloadRetrieveRequest
*/
export interface MetaApiMetaProductPreloadRetrieveRequest {
/**
*
* @type {string}
* @memberof MetaApiMetaProductPreloadRetrieve
*/
readonly sku: string

/**
*
* @type {string}
* @memberof MetaApiMetaProductPreloadRetrieve
*/
readonly system_slug: string
}

/**
* Request parameters for metaProductRetrieve operation in MetaApi.
* @export
Expand Down Expand Up @@ -3871,6 +3993,26 @@ export class MetaApi extends BaseAPI {
.then((request) => request(this.axios, this.basePath))
}

/**
* Pre-loads the product metadata for a given SKU, even if the SKU doesn\'t exist yet.
* @param {MetaApiMetaProductPreloadRetrieveRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MetaApi
*/
public metaProductPreloadRetrieve(
requestParameters: MetaApiMetaProductPreloadRetrieveRequest,
options?: RawAxiosRequestConfig,
) {
return MetaApiFp(this.configuration)
.metaProductPreloadRetrieve(
requestParameters.sku,
requestParameters.system_slug,
options,
)
.then((request) => request(this.axios, this.basePath))
}

/**
* Viewset for Product model.
* @param {MetaApiMetaProductRetrieveRequest} requestParameters Request parameters.
Expand Down
Loading

0 comments on commit 6f02a2c

Please sign in to comment.