Skip to content

Commit

Permalink
fix(frontend): update interop openapi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-j-baker committed Mar 5, 2025
1 parent 44e0621 commit 299b720
Show file tree
Hide file tree
Showing 12 changed files with 1,014 additions and 1,005 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ import { ErrorCodes } from '~/errors/error-codes';
* @returns A promise that resolves with the SIN application response data.
* @throws {AppError} If the API call fails or the response data is missing.
*/

export async function submitSinApplication(
submitSinApplicationRequest: SinApplicationRequest,
): Promise<SinApplicationResponse> {
const { response, data } = await api.submitSinApplication({ body: submitSinApplicationRequest });
const { response, data } = await api.postSinApplication({ body: submitSinApplicationRequest });

if (data === undefined) {
const content = await response.text();
throw new AppError(
`Failed to submit SIN application; stastus: ${response.status}; content: ${content}`,
ErrorCodes.FAILED_SUBMIT_SIN_APPLICATION,
ErrorCodes.SUBMIT_SIN_APPLICATION_FAILED,
);
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/.server/shared/api/client.gen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is auto-generated by @hey-api/openapi-ts
import { createClient, createConfig } from '@hey-api/client-fetch';
import type { Config, ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
import { createClient, createConfig } from '@hey-api/client-fetch';

import { createClientConfig } from '../client-config';
import type { ClientOptions } from './types.gen';
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/.server/shared/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is auto-generated by @hey-api/openapi-ts
export type * from './types.gen';
export * from './sdk.gen';
export type * from './types.gen';
10 changes: 5 additions & 5 deletions frontend/app/.server/shared/api/sdk.gen.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
import type { Client, Options as ClientOptions, TDataShape } from '@hey-api/client-fetch';

import { client as _heyApiClient } from './client.gen';
import type { SubmitSinApplicationData, SubmitSinApplicationResponse } from './types.gen';
import type { PostSinApplicationData, PostSinApplicationResponse } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
TData,
Expand All @@ -21,10 +21,10 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
meta?: Record<string, unknown>;
};

export const submitSinApplication = <ThrowOnError extends boolean = false>(
options: Options<SubmitSinApplicationData, ThrowOnError>,
export const postSinApplication = <ThrowOnError extends boolean = false>(
options: Options<PostSinApplicationData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).post<SubmitSinApplicationResponse, unknown, ThrowOnError>({
return (options.client ?? _heyApiClient).post<PostSinApplicationResponse, unknown, ThrowOnError>({
url: '/SINApplication',
...options,
headers: {
Expand Down
23 changes: 15 additions & 8 deletions frontend/app/.server/shared/api/types.gen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

export type SinApplicationResponse = {
SINApplication?: SinApplicationType;
SINApplication?: SinApplicationTypeResponse;
};

/**
Expand All @@ -11,6 +11,13 @@ export type SinApplicationRequest = {
SINApplication?: SinApplicationType;
};

/**
* A data type for the SIN Application resource.
*/
export type SinApplicationTypeResponse = {
SINApplicationIdentification?: SinApplicationIdentification;
};

/**
* A data type for the SIN Application resource.
*/
Expand Down Expand Up @@ -86,8 +93,8 @@ export type CertificateType = ResourceType & {
CertificateExpiryDate?: CertificateExpiryDate;
CertificateIdentification?: CertificateIdentification[];
CertificateIssueDate?: CertificateIssueDate;
Client: CertificateClient;
RelatedPerson?: RelatedPerson;
Client?: CertificateClient;
RelatedPerson?: RelatedPerson[];
};

/**
Expand Down Expand Up @@ -156,7 +163,7 @@ export type LocationType = {
*/
export type PersonNameType = {
PersonFullName?: PersonFullName;
PersonGivenName?: PersonGivenName[];
PersonGivenName?: PersonGivenName;
PersonNameCategoryCode?: PersonNameCategoryCode;
PersonSurName?: PersonSurName;
};
Expand Down Expand Up @@ -382,22 +389,22 @@ export type ValueBoolean = boolean;
*/
export type ValueString = string;

export type SubmitSinApplicationData = {
export type PostSinApplicationData = {
body: SinApplicationRequest;
path?: never;
query?: never;
url: '/SINApplication';
};

export type SubmitSinApplicationResponses = {
export type PostSinApplicationResponses = {
/**
* Success
*/
200: SinApplicationResponse;
};

export type SubmitSinApplicationResponse = SubmitSinApplicationResponses[keyof SubmitSinApplicationResponses];
export type PostSinApplicationResponse = PostSinApplicationResponses[keyof PostSinApplicationResponses];

export type ClientOptions = {
baseUrl: `${string}://fsir-openapi.yml` | (string & {});
baseUrl: `${string}://other` | (string & {});
};
2 changes: 1 addition & 1 deletion frontend/app/errors/error-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ export const ErrorCodes = {
NO_PROVINCE_FOUND: 'SVC-0008',
NO_TYPE_OF_APPLICATION_TO_SUBMIT_FOUND: 'SVC-0009',
NO_LANGUAGE_OF_CORRESPONDENCE_FOUND: 'SVC-0010',
FAILED_SUBMIT_SIN_APPLICATION: 'SVC-0011',
SUBMIT_SIN_APPLICATION_FAILED: 'SVC-0011',
} as const;
Loading

0 comments on commit 299b720

Please sign in to comment.