Skip to content

Commit

Permalink
Fix: types schema naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
rkmonarch committed Oct 26, 2023
1 parent 7181afa commit 38b2f63
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/address-book/create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from "axios";
import Apis from "../utils/api-config";
import {addressbookSchemaType} from "../types/address-book/index";
import {AddressBook} from "../types/address-book/index";
import { Headers } from "../types";

export const _create = async (data: addressbookSchemaType, headers:Headers): Promise<any> => {
export const _create = async (data: AddressBook, headers:Headers): Promise<any> => {
const req = await axios({
url: `${Apis.wAddressBookEndpoint}`,
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions src/address-book/generate-message.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from "axios";
import Apis from "../utils/api-config";
import {addressbookMessageSchema} from "../types/address-book/index";
import {AddressbookMessage} from "../types/address-book/index";
import { Headers } from "../types";

export const _generateMessage = async (data: addressbookMessageSchema, headers: Headers): Promise<any> => {
export const _generateMessage = async (data: AddressbookMessage, headers: Headers): Promise<any> => {
const req = await axios({
url: `${Apis.wAddressBookGenerateMessageEndpoint}`,
method: "POST",
Expand Down
16 changes: 10 additions & 6 deletions src/address-book/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {_get} from './get';
import {_generateMessage} from './addressbook-generate-message';
import {_create} from './create-addressbook';
import {_update} from './update-addressbook';
import {addressbookMessageSchema, updateAddressbookSchemaType,addressbookSchemaType} from "../types/address-book/index";
import {_generateMessage} from './generate-message';
import {_create} from './create';
import {_update} from './update';
import {UpdateAddressbook, AddressBook, AddressbookMessage, } from "../types/address-book/index";
import { Headers } from '../types';
export default class Addressbook{
private headers: Headers
Expand All @@ -15,11 +15,15 @@ export default class Addressbook{
return _get(owner, this.headers)
}

generateMessage(data: addressbookMessageSchema) {
generateMessage(data: AddressbookMessage) {
return _generateMessage(data, this.headers)
}

create(data: addressbookSchemaType) {
create(data: AddressBook) {
return _create(data,this.headers)
}

update(data: UpdateAddressbook) {
return _update(data, this.headers)
}
}
4 changes: 2 additions & 2 deletions src/address-book/update.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Apis from "../utils/api-config";
import axios from "axios";
import {updateAddressbookSchemaType} from "../types/address-book/index";
import {UpdateAddressbook} from "../types/address-book/index";
import { Headers } from "../types";

export const _update = async (data: updateAddressbookSchemaType, headers:Headers): Promise<any> => {
export const _update = async (data: UpdateAddressbook, headers:Headers): Promise<any> => {
const req = await axios({
url: Apis.wAddressBookEndpoint,
method: "PATCH",
Expand Down
4 changes: 2 additions & 2 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { _login } from "./login";
import { _generateMessage } from "./login-message";
import { AuthSchema, Headers } from "../types";
import { Authentication, Headers } from "../types";

export default class Auth {
private headers: Headers
Expand All @@ -9,7 +9,7 @@ export default class Auth {
this.headers = headers
}

login(actions: AuthSchema) {
login(actions: Authentication) {
return _login(actions,this.headers)
}

Expand Down
4 changes: 2 additions & 2 deletions src/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Apis from "../utils/api-config";
import axios from "axios";
import { AuthSchema, } from "../types/auth";
import { Authentication } from "../types/auth";
import { Headers } from "../types";

export const _login = async (auth: AuthSchema,headers:Headers): Promise<any[]> => {
export const _login = async (auth: Authentication,headers:Headers): Promise<any[]> => {
const req = await axios({
url: Apis.wAuthenticationEndpoint,
method: 'POST',
Expand Down
4 changes: 2 additions & 2 deletions src/identity/generate-message.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from "axios";
import Apis from "../utils/api-config";
import { generateIdentityMessageSchema } from "../types/identity";
import { GenerateIdentityMessage } from "../types/identity";
import { Headers } from "../types";

export const _generateMessage = async (data: generateIdentityMessageSchema, headers: Headers): Promise<any[]> => {
export const _generateMessage = async (data: GenerateIdentityMessage, headers: Headers): Promise<any[]> => {

const req = await axios({
url: Apis.wIdentityGenerateMessageEndpoint,
Expand Down
10 changes: 5 additions & 5 deletions src/identity/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {_get} from "./get";
import {_generateMessage} from "./generate-identity-message";
import {_create} from "./create-identity";
import {_generateMessage} from "./generate-message";
import {_create} from "./create";
import { Headers } from '../types';
import {generateIdentityMessageSchema, identitySchema} from "../types/identity";
import {GenerateIdentityMessage, Identity} from "../types/identity";
export default class identity {

private headers: Headers
Expand All @@ -15,11 +15,11 @@ export default class identity {
return _get(id, this.headers)
}

generateMessage(data: generateIdentityMessageSchema) {
generateMessage(data: GenerateIdentityMessage) {
return _generateMessage(data, this.headers)
}

create(data: identitySchema) {
create(data: Identity) {
return _create(data,this.headers)
}
}
4 changes: 2 additions & 2 deletions src/request/create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { RequestSchema } from "../types/request"
import { PaymentRequest } from "../types/request"
import Apis from "../utils/api-config"
import axios from "axios"
import { Headers } from "../types"

export const _create = async (data: RequestSchema, headers: Headers): Promise<any[]> => {
export const _create = async (data: PaymentRequest, headers: Headers): Promise<any[]> => {
const req = await axios({
url: Apis.wPaymentRequestEndpoint,
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions src/request/generate-message.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MessageSchema } from '../types/request/index';
import { GenerateMessage } from '../types/request/index';
import axios from "axios";
import Apis from "../utils/api-config";
import { Headers } from '../types';

export const _generateMessage = async (data: MessageSchema, headers:Headers): Promise<any[]> => {
export const _generateMessage = async (data: GenerateMessage, headers:Headers): Promise<any[]> => {
const req = await axios({
url: Apis.wPaymentRequestGenerateMessageEndpoint,
method: "POST",
Expand Down
12 changes: 6 additions & 6 deletions src/request/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { _get } from './get'
import { _create } from './create-request'
import { _create } from './create'
import { _generateMessage } from './generate-message'
import { _update } from './update-request'
import { _update } from './update'
import {Headers} from '../types'
import {RequestSchema, MessageSchema, UpdateRequestSchema} from '../types/request/index'
import {PaymentRequest, UpdateRequest, GenerateMessage} from '../types/request/index'
export default class Request {
private headers: Headers

Expand All @@ -15,15 +15,15 @@ export default class Request {
return _get(requestId, this.headers)
}

create(data: RequestSchema) {
create(data: PaymentRequest) {
return _create(data, this.headers)
}

generateMessage(data: MessageSchema) {
generateMessage(data: GenerateMessage) {
return _generateMessage(data, this.headers)
}

update(data: UpdateRequestSchema) {
update(data: UpdateRequest) {
return _update(data, this.headers)
}
}
4 changes: 2 additions & 2 deletions src/request/update.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from "axios";
import Apis from "../utils/api-config";
import { UpdateRequestSchema } from "../types/request";
import { UpdateRequest } from "../types/request";
import { Headers } from "../types";

export const _update = async (body: UpdateRequestSchema, headers: Headers): Promise<any[]> => {
export const _update = async (body: UpdateRequest, headers: Headers): Promise<any[]> => {
const req = await axios({
url: Apis.wPaymentRequestEndpoint,
method: "PATCH",
Expand Down
6 changes: 3 additions & 3 deletions src/types/address-book/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export const updateAddressbookSchema = z.object({
signature: z.string(),
});

export type addressbookMessageSchema = z.infer<typeof addressbookGenerateMessage>;
export type addressbookSchemaType = z.infer<typeof addressbookSchema>;
export type updateAddressbookSchemaType = z.infer<typeof updateAddressbookSchema>;
export type AddressbookMessage = z.infer<typeof addressbookGenerateMessage>;
export type AddressBook = z.infer<typeof addressbookSchema>;
export type UpdateAddressbook = z.infer<typeof updateAddressbookSchema>;
2 changes: 1 addition & 1 deletion src/types/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const authSchema = z.object({
timestamp: z.number(),
});

export type AuthSchema = z.infer<typeof authSchema>
export type Authentication = z.infer<typeof authSchema>
4 changes: 2 additions & 2 deletions src/types/identity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export const generateMessage = z.object({
secondary: z.array(addressConfig).optional(),
});

export type generateIdentityMessageSchema = z.infer<typeof generateMessage>;
export type identitySchema = z.infer<typeof identity>;
export type GenerateIdentityMessage = z.infer<typeof generateMessage>;
export type Identity = z.infer<typeof identity>;
6 changes: 3 additions & 3 deletions src/types/request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export const MessageSchema = z.object({
label: z.string(),
})

export type RequestSchema = z.input<typeof requestSchema>
export type PaymentRequest = z.input<typeof requestSchema>
export type Actions = z.input<typeof actionsSchema>
export type UpdateRequestSchema = z.input<typeof updateRequestSchema>
export type MessageSchema = z.input<typeof MessageSchema>
export type UpdateRequest = z.input<typeof updateRequestSchema>
export type GenerateMessage = z.input<typeof MessageSchema>

export * from "./request-intent-types"

0 comments on commit 38b2f63

Please sign in to comment.