Skip to content

Commit

Permalink
api: Sync with backend schema
Browse files Browse the repository at this point in the history
  • Loading branch information
carina-akaia committed Jun 12, 2024
1 parent 9f64dbd commit 456adca
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/common/api/potlock/generated/schemas/Account.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type":"object","properties":{"id":{"description":"On-chain account address.","type":"string","maxLength":64,"title":"Address"},"total_donations_in_usd":{"description":"Total donations received in USD.","type":"string","format":"decimal","pattern":"^-?\\d{0,18}(?:\\.\\d{0,2})?$","title":"Total donations received in USD"},"total_donations_out_usd":{"description":"Total donated in USD.","type":"string","format":"decimal","pattern":"^-?\\d{0,18}(?:\\.\\d{0,2})?$","title":"Total donations sent in USD"},"total_matching_pool_allocations_usd":{"description":"Total matching pool allocations in USD.","type":"string","format":"decimal","pattern":"^-?\\d{0,18}(?:\\.\\d{0,2})?$","title":"Total matching pool allocations in USD"},"donors_count":{"description":"Number of donors.","type":"integer","maximum":2147483647,"minimum":0},"near_social_profile_data":{"description":"NEAR social data contained under 'profile' key.","nullable":true}},"required":["id"],"x-readme-ref-name":"Account"}
{"type":"object","properties":{"id":{"description":"On-chain account address.","type":"string","maxLength":64,"title":"Address"},"total_donations_in_usd":{"type":"number","format":"double","exclusiveMaximum":true,"exclusiveMinimum":true,"maximum":1000000000000000000,"minimum":-1000000000000000000},"total_donations_out_usd":{"type":"number","format":"double","exclusiveMaximum":true,"exclusiveMinimum":true,"maximum":1000000000000000000,"minimum":-1000000000000000000},"total_matching_pool_allocations_usd":{"type":"number","format":"double","exclusiveMaximum":true,"exclusiveMinimum":true,"maximum":1000000000000000000,"minimum":-1000000000000000000},"donors_count":{"type":"integer"},"near_social_profile_data":{"type":"object","properties":{"name":{"type":"string"},"image":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"ipfs_cid":{"type":"string"},"nft":{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}},"x-readme-ref-name":"Image"},"backgroundImage":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"ipfs_cid":{"type":"string"},"nft":{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}},"x-readme-ref-name":"Image"},"description":{"type":"string"},"linktree":{"type":"object","properties":{"github":{"type":"string"},"twitter":{"type":"string"},"website":{"type":"string"},"telegram":{"type":"string"}},"x-readme-ref-name":"Linktree"},"plPublicGoodReason":{"type":"string"},"plCategories":{"description":"JSON-stringified array of category strings","type":"string"},"plGithubRepos":{"description":"JSON-stringified array of URLs","type":"string"},"plSmartContracts":{"description":"JSON-stringified object with chain names as keys that map to nested objects of contract addresses","type":"string"},"plFundingSources":{"description":"JSON-stringified array of funding source objects","type":"string"},"plTeam":{"description":"JSON-stringified array of team member account ID strings","type":"string"}},"x-readme-ref-name":"NearSocialProfileData"}},"required":["donors_count","id","total_donations_in_usd","total_donations_out_usd","total_matching_pool_allocations_usd"],"x-readme-ref-name":"Account"}
1 change: 1 addition & 0 deletions src/common/api/potlock/generated/schemas/Image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"object","properties":{"url":{"type":"string","format":"uri"},"ipfs_cid":{"type":"string"},"nft":{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}},"x-readme-ref-name":"Image"}
1 change: 1 addition & 0 deletions src/common/api/potlock/generated/schemas/Linktree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"object","properties":{"github":{"type":"string"},"twitter":{"type":"string"},"website":{"type":"string"},"telegram":{"type":"string"}},"x-readme-ref-name":"Linktree"}
1 change: 1 addition & 0 deletions src/common/api/potlock/generated/schemas/NFT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"object","properties":{"name":{"type":"string"},"image":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"ipfs_cid":{"type":"string"},"nft":{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}},"x-readme-ref-name":"Image"},"backgroundImage":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"ipfs_cid":{"type":"string"},"nft":{"type":"object","properties":{"media":{"type":"string","format":"uri"},"baseUri":{"type":"string","format":"uri"},"tokenId":{"type":"string"},"contractId":{"type":"string"}},"x-readme-ref-name":"NFT"}},"x-readme-ref-name":"Image"},"description":{"type":"string"},"linktree":{"type":"object","properties":{"github":{"type":"string"},"twitter":{"type":"string"},"website":{"type":"string"},"telegram":{"type":"string"}},"x-readme-ref-name":"Linktree"},"plPublicGoodReason":{"type":"string"},"plCategories":{"description":"JSON-stringified array of category strings","type":"string"},"plGithubRepos":{"description":"JSON-stringified array of URLs","type":"string"},"plSmartContracts":{"description":"JSON-stringified object with chain names as keys that map to nested objects of contract addresses","type":"string"},"plFundingSources":{"description":"JSON-stringified array of funding source objects","type":"string"},"plTeam":{"description":"JSON-stringified array of team member account ID strings","type":"string"}},"x-readme-ref-name":"NearSocialProfileData"}
24 changes: 11 additions & 13 deletions src/common/api/potlock/generated/types/Account.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import { NearSocialProfileData } from "./NearSocialProfileData";

export type Account = {
/**
* @description On-chain account address.
* @type string
*/
id: string;
/**
* @description Total donations received in USD.
* @type string | undefined, decimal
* @type number, double
*/
total_donations_in_usd?: string;
total_donations_in_usd: number;
/**
* @description Total donated in USD.
* @type string | undefined, decimal
* @type number, double
*/
total_donations_out_usd?: string;
total_donations_out_usd: number;
/**
* @description Total matching pool allocations in USD.
* @type string | undefined, decimal
* @type number, double
*/
total_matching_pool_allocations_usd?: string;
total_matching_pool_allocations_usd: number;
/**
* @description Number of donors.
* @type integer | undefined
* @type integer
*/
donors_count?: number;
near_social_profile_data?: any;
donors_count: number;
near_social_profile_data?: NearSocialProfileData;
};
13 changes: 13 additions & 0 deletions src/common/api/potlock/generated/types/Image.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Nft } from "./Nft";

export type Image = {
/**
* @type string | undefined, uri
*/
url?: string;
/**
* @type string | undefined
*/
ipfs_cid?: string;
nft?: Nft;
};
18 changes: 18 additions & 0 deletions src/common/api/potlock/generated/types/Linktree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export type Linktree = {
/**
* @type string | undefined
*/
github?: string;
/**
* @type string | undefined
*/
twitter?: string;
/**
* @type string | undefined
*/
website?: string;
/**
* @type string | undefined
*/
telegram?: string;
};
45 changes: 45 additions & 0 deletions src/common/api/potlock/generated/types/NearSocialProfileData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Image } from "./Image";
import { Linktree } from "./Linktree";

export type NearSocialProfileData = {
/**
* @type string | undefined
*/
name?: string;
image?: Image;
backgroundImage?: Image;
/**
* @type string | undefined
*/
description?: string;
linktree?: Linktree;
/**
* @type string | undefined
*/
plPublicGoodReason?: string;
/**
* @description JSON-stringified array of category strings
* @type string | undefined
*/
plCategories?: string;
/**
* @description JSON-stringified array of URLs
* @type string | undefined
*/
plGithubRepos?: string;
/**
* @description JSON-stringified object with chain names as keys that map to nested objects of contract addresses
* @type string | undefined
*/
plSmartContracts?: string;
/**
* @description JSON-stringified array of funding source objects
* @type string | undefined
*/
plFundingSources?: string;
/**
* @description JSON-stringified array of team member account ID strings
* @type string | undefined
*/
plTeam?: string;
};
18 changes: 18 additions & 0 deletions src/common/api/potlock/generated/types/Nft.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export type Nft = {
/**
* @type string | undefined, uri
*/
media?: string;
/**
* @type string | undefined, uri
*/
baseUri?: string;
/**
* @type string | undefined
*/
tokenId?: string;
/**
* @type string | undefined
*/
contractId?: string;
};
4 changes: 4 additions & 0 deletions src/common/api/potlock/generated/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export * from "./Account";
export * from "./DefaultRegistrationStatusEnum";
export * from "./Donation";
export * from "./Image";
export * from "./Linktree";
export * from "./List";
export * from "./ListRegistration";
export * from "./NearSocialProfileData";
export * from "./Nft";
export * from "./Pot";
export * from "./PotApplication";
export * from "./PotApplicationStatusEnum";
Expand Down
30 changes: 13 additions & 17 deletions src/common/api/potlock/generated/zod/accountSchema.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import { z } from "zod";

import { nearSocialProfileDataSchema } from "./nearSocialProfileDataSchema";

export const accountSchema = z.object({
id: z.string().max(64).describe("On-chain account address."),
total_donations_in_usd: z
.string()
.regex(new RegExp("^-?\\d{0,18}(?:\\.\\d{0,2})?$"))
.describe("Total donations received in USD.")
.optional(),
.number()
.min(-1000000000000000000)
.max(1000000000000000000),
total_donations_out_usd: z
.string()
.regex(new RegExp("^-?\\d{0,18}(?:\\.\\d{0,2})?$"))
.describe("Total donated in USD.")
.optional(),
.number()
.min(-1000000000000000000)
.max(1000000000000000000),
total_matching_pool_allocations_usd: z
.string()
.regex(new RegExp("^-?\\d{0,18}(?:\\.\\d{0,2})?$"))
.describe("Total matching pool allocations in USD.")
.optional(),
donors_count: z
.number()
.min(0)
.max(2147483647)
.describe("Number of donors.")
.min(-1000000000000000000)
.max(1000000000000000000),
donors_count: z.number(),
near_social_profile_data: z
.lazy(() => nearSocialProfileDataSchema)
.optional(),
near_social_profile_data: z.any().nullish(),
});
9 changes: 9 additions & 0 deletions src/common/api/potlock/generated/zod/imageSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { z } from "zod";

import { nftSchema } from "./nftSchema";

export const imageSchema = z.object({
url: z.string().url().optional(),
ipfs_cid: z.string().optional(),
nft: z.lazy(() => nftSchema).optional(),
});
4 changes: 4 additions & 0 deletions src/common/api/potlock/generated/zod/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export * from "./accountSchema";
export * from "./defaultRegistrationStatusEnumSchema";
export * from "./donationSchema";
export * from "./imageSchema";
export * from "./linktreeSchema";
export * from "./listRegistrationSchema";
export * from "./listSchema";
export * from "./nearSocialProfileDataSchema";
export * from "./nftSchema";
export * from "./potApplicationSchema";
export * from "./potApplicationStatusEnumSchema";
export * from "./potPayoutSchema";
Expand Down
8 changes: 8 additions & 0 deletions src/common/api/potlock/generated/zod/linktreeSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { z } from "zod";

export const linktreeSchema = z.object({
github: z.string().optional(),
twitter: z.string().optional(),
website: z.string().optional(),
telegram: z.string().optional(),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { z } from "zod";

import { imageSchema } from "./imageSchema";
import { linktreeSchema } from "./linktreeSchema";

export const nearSocialProfileDataSchema = z.object({
name: z.string().optional(),
image: z.lazy(() => imageSchema).optional(),
backgroundImage: z.lazy(() => imageSchema).optional(),
description: z.string().optional(),
linktree: z.lazy(() => linktreeSchema).optional(),
plPublicGoodReason: z.string().optional(),
plCategories: z
.string()
.describe("JSON-stringified array of category strings")
.optional(),
plGithubRepos: z
.string()
.describe("JSON-stringified array of URLs")
.optional(),
plSmartContracts: z
.string()
.describe(
"JSON-stringified object with chain names as keys that map to nested objects of contract addresses",
)
.optional(),
plFundingSources: z
.string()
.describe("JSON-stringified array of funding source objects")
.optional(),
plTeam: z
.string()
.describe("JSON-stringified array of team member account ID strings")
.optional(),
});
8 changes: 8 additions & 0 deletions src/common/api/potlock/generated/zod/nftSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { z } from "zod";

export const nftSchema = z.object({
media: z.string().url().optional(),
baseUri: z.string().url().optional(),
tokenId: z.string().optional(),
contractId: z.string().optional(),
});

0 comments on commit 456adca

Please sign in to comment.