-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
620 additions
and
137 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
carbonmark/.generated/carbonmark-api-sdk/clients/getActivities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { ResponseConfig } from "../client"; | ||
import client from "../client"; | ||
import type { | ||
GetActivitiesQueryParams, | ||
GetActivitiesQueryResponse, | ||
} from "../types/GetActivities"; | ||
|
||
/** | ||
* @description Retrieve an array of activities related to a carbon project | ||
* @summary List project activities | ||
* @link /activities | ||
*/ | ||
export async function getActivities<TData = GetActivitiesQueryResponse>( | ||
params?: GetActivitiesQueryParams, | ||
options: Partial<Parameters<typeof client>[0]> = {} | ||
): Promise<ResponseConfig<TData>["data"]> { | ||
const { data: resData } = await client<TData>({ | ||
method: "get", | ||
url: `/activities`, | ||
params, | ||
...options, | ||
}); | ||
|
||
return resData; | ||
} |
29 changes: 29 additions & 0 deletions
29
carbonmark/.generated/carbonmark-api-sdk/clients/getProjectsIdActivity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { ResponseConfig } from "../client"; | ||
import client from "../client"; | ||
import type { | ||
GetProjectsIdActivityPathParams, | ||
GetProjectsIdActivityQueryParams, | ||
GetProjectsIdActivityQueryResponse, | ||
} from "../types/GetProjectsIdActivity"; | ||
|
||
/** | ||
* @description Retrieve an array of activities related to a carbon project | ||
* @summary List project activities | ||
* @link /projects/:id/activity | ||
*/ | ||
export async function getProjectsIdActivity< | ||
TData = GetProjectsIdActivityQueryResponse, | ||
>( | ||
id: GetProjectsIdActivityPathParams["id"], | ||
params?: GetProjectsIdActivityQueryParams, | ||
options: Partial<Parameters<typeof client>[0]> = {} | ||
): Promise<ResponseConfig<TData>["data"]> { | ||
const { data: resData } = await client<TData>({ | ||
method: "get", | ||
url: `/projects/${id}/activity`, | ||
params, | ||
...options, | ||
}); | ||
|
||
return resData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
carbonmark/.generated/carbonmark-api-sdk/clients/operations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
export const operations = { | ||
get_activities: { path: "/activities", method: "get" }, | ||
get_categories: { path: "/categories", method: "get" }, | ||
get_projects: { path: "/projects", method: "get" }, | ||
get_countries: { path: "/countries", method: "get" }, | ||
get_projects: { path: "/projects", method: "get" }, | ||
"get_users-walletorhandle": { path: "/users/:walletOrHandle", method: "get" }, | ||
post_users: { path: "/users", method: "post" }, | ||
"put_users-wallet": { path: "/users/:wallet", method: "put" }, | ||
get_vintages: { path: "/vintages", method: "get" }, | ||
"get_projects-id": { path: "/projects/:id", method: "get" }, | ||
"get_purchases-id": { path: "/purchases/:id", method: "get" }, | ||
"post_users-login": { path: "/users/login", method: "post" }, | ||
"get_projects-id-activity": { path: "/projects/:id/activity", method: "get" }, | ||
"post_users-login-verify": { path: "/users/login/verify", method: "post" }, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
carbonmark/.generated/carbonmark-api-sdk/hooks/useGetActivities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import type { SWRConfiguration, SWRResponse } from "swr"; | ||
import useSWR from "swr"; | ||
import client from "../../../lib/api/client"; | ||
import type { | ||
GetActivitiesQueryParams, | ||
GetActivitiesQueryResponse, | ||
} from "../types/GetActivities"; | ||
|
||
export function getActivitiesQueryOptions< | ||
TData = GetActivitiesQueryResponse, | ||
TError = unknown, | ||
>( | ||
params?: GetActivitiesQueryParams, | ||
options: Partial<Parameters<typeof client>[0]> = {} | ||
): SWRConfiguration<TData, TError> { | ||
return { | ||
fetcher: () => { | ||
return client<TData, TError>({ | ||
method: "get", | ||
url: `/activities`, | ||
|
||
params, | ||
|
||
...options, | ||
}).then((res) => res.data); | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* @description Retrieve an array of activities related to a carbon project | ||
* @summary List project activities | ||
* @link /activities | ||
*/ | ||
|
||
export function useGetActivities< | ||
TData = GetActivitiesQueryResponse, | ||
TError = unknown, | ||
>( | ||
params?: GetActivitiesQueryParams, | ||
options?: { | ||
query?: SWRConfiguration<TData, TError>; | ||
client?: Partial<Parameters<typeof client<TData, TError>>[0]>; | ||
shouldFetch?: boolean; | ||
} | ||
): SWRResponse<TData, TError> { | ||
const { | ||
query: queryOptions, | ||
client: clientOptions = {}, | ||
shouldFetch = true, | ||
} = options ?? {}; | ||
|
||
const url = shouldFetch ? `/activities` : null; | ||
const query = useSWR<TData, TError, string | null>(url, { | ||
...getActivitiesQueryOptions<TData, TError>(params, clientOptions), | ||
...queryOptions, | ||
}); | ||
|
||
return query; | ||
} |
67 changes: 67 additions & 0 deletions
67
carbonmark/.generated/carbonmark-api-sdk/hooks/useGetProjectsIdActivity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { SWRConfiguration, SWRResponse } from "swr"; | ||
import useSWR from "swr"; | ||
import client from "../../../lib/api/client"; | ||
import type { | ||
GetProjectsIdActivityPathParams, | ||
GetProjectsIdActivityQueryParams, | ||
GetProjectsIdActivityQueryResponse, | ||
} from "../types/GetProjectsIdActivity"; | ||
|
||
export function getProjectsIdActivityQueryOptions< | ||
TData = GetProjectsIdActivityQueryResponse, | ||
TError = unknown, | ||
>( | ||
id: GetProjectsIdActivityPathParams["id"], | ||
params?: GetProjectsIdActivityQueryParams, | ||
options: Partial<Parameters<typeof client>[0]> = {} | ||
): SWRConfiguration<TData, TError> { | ||
return { | ||
fetcher: () => { | ||
return client<TData, TError>({ | ||
method: "get", | ||
url: `/projects/${id}/activity`, | ||
|
||
params, | ||
|
||
...options, | ||
}).then((res) => res.data); | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* @description Retrieve an array of activities related to a carbon project | ||
* @summary List project activities | ||
* @link /projects/:id/activity | ||
*/ | ||
|
||
export function useGetProjectsIdActivity< | ||
TData = GetProjectsIdActivityQueryResponse, | ||
TError = unknown, | ||
>( | ||
id: GetProjectsIdActivityPathParams["id"], | ||
params?: GetProjectsIdActivityQueryParams, | ||
options?: { | ||
query?: SWRConfiguration<TData, TError>; | ||
client?: Partial<Parameters<typeof client<TData, TError>>[0]>; | ||
shouldFetch?: boolean; | ||
} | ||
): SWRResponse<TData, TError> { | ||
const { | ||
query: queryOptions, | ||
client: clientOptions = {}, | ||
shouldFetch = true, | ||
} = options ?? {}; | ||
|
||
const url = shouldFetch ? `/projects/${id}/activity` : null; | ||
const query = useSWR<TData, TError, string | null>(url, { | ||
...getProjectsIdActivityQueryOptions<TData, TError>( | ||
id, | ||
params, | ||
clientOptions | ||
), | ||
...queryOptions, | ||
}); | ||
|
||
return query; | ||
} |
51 changes: 51 additions & 0 deletions
51
carbonmark/.generated/carbonmark-api-sdk/types/GetActivities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { Def1 } from "./Def1"; | ||
|
||
/** | ||
* @description List of project activities | ||
*/ | ||
export type GetActivitiesQueryResponse = { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
amount?: string | null; | ||
previousAmount?: string | null; | ||
price?: string | null; | ||
previousPrice?: string | null; | ||
timeStamp?: string | null; | ||
activityType?: string | null; | ||
seller?: { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
handle?: string | null; | ||
} | null; | ||
buyer?: { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
handle?: string | null; | ||
} | null; | ||
}[]; | ||
|
||
export type GetActivitiesQueryParams = { | ||
network?: Def1; | ||
/** | ||
* @description Filter returned activities by project | ||
* @type string | undefined | ||
*/ | ||
projectId?: string; | ||
/** | ||
* @type array | undefined | ||
*/ | ||
activityType?: ( | ||
| "CreatedListing" | ||
| "DeletedListing" | ||
| "Purchase" | ||
| "Sold" | ||
| "UpdatedPrice" | ||
| "UpdatedQuantity" | ||
)[]; | ||
}; |
59 changes: 59 additions & 0 deletions
59
carbonmark/.generated/carbonmark-api-sdk/types/GetProjectsIdActivity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import type { Def1 } from "./Def1"; | ||
|
||
export type GetProjectsIdActivityPathParams = { | ||
/** | ||
* @description Project id & vintage | ||
* @type string | ||
*/ | ||
id: string; | ||
}; | ||
|
||
/** | ||
* @description List of project activities | ||
*/ | ||
export type GetProjectsIdActivityQueryResponse = { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
amount?: string | null; | ||
previousAmount?: string | null; | ||
price?: string | null; | ||
previousPrice?: string | null; | ||
timeStamp?: string | null; | ||
activityType?: string | null; | ||
seller?: { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
handle?: string | null; | ||
} | null; | ||
buyer?: { | ||
/** | ||
* @type string | ||
*/ | ||
id: string; | ||
handle?: string | null; | ||
} | null; | ||
}[]; | ||
|
||
export type GetProjectsIdActivityQueryParams = { | ||
network?: Def1; | ||
/** | ||
* @description Filter returned activities by project | ||
* @type string | undefined | ||
*/ | ||
projectId?: string; | ||
/** | ||
* @type array | undefined | ||
*/ | ||
activityType?: ( | ||
| "CreatedListing" | ||
| "DeletedListing" | ||
| "Purchase" | ||
| "Sold" | ||
| "UpdatedPrice" | ||
| "UpdatedQuantity" | ||
)[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.