Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions src/declarations/api_canister/api_canister.did
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,71 @@ type ApiError =
Unauthorized;
ZeroAddress;
};
// Activity Feed Types
type ActivityFeedQuery =
record {
page: opt nat;
limit: opt nat;
};
type ActivityFeedChallenge =
record {
challengeId: text;
challengeQuestion: text;
challengeTopic: text;
challengeCreationTimestamp: nat64;
challengeStatus: variant { Open; Closed; Archived; };
};
type ActivityFeedParticipant =
record {
submittedBy: principal;
submissionId: text;
ownedBy: principal;
reward: record {
amount: nat;
rewardType: variant { MainerToken; Cycles; ICP; };
distributed: bool;
};
result: variant { Winner; SecondPlace; ThirdPlace; Participated; };
};
type ActivityFeedWinner =
record {
challengeId: text;
challengeQuestion: text;
finalizedTimestamp: nat64;
winner: ActivityFeedParticipant;
secondPlace: ActivityFeedParticipant;
thirdPlace: opt ActivityFeedParticipant;
};
type ActivityFeedResponse =
record {
open_challenges: vec ActivityFeedChallenge;
winners: vec ActivityFeedWinner;
has_more: bool;
total_count: nat;
};
type ActivityFeedResult =
variant {
Err: ApiError;
Ok: ActivityFeedResponse;
};
type ActivityFeedCacheStatus =
record {
last_updated: nat64;
total_items: nat;
open_challenges_count: nat;
winners_count: nat;
};
type ActivityFeedCacheStatusResult =
variant {
Err: ApiError;
Ok: ActivityFeedCacheStatus;
};
type OpenChallengesResult =
variant {
Err: ApiError;
Ok: vec ActivityFeedChallenge;
};

type ApiCanister =
service {
amiController: () -> (AuthRecordResult) query;
Expand All @@ -220,6 +285,8 @@ type ApiCanister =
bulkCreateDailyMetricsAdmin: (inputs: vec DailyMetricInput) -> (NatResult);
createDailyMetricAdmin: (input: DailyMetricInput) -> (DailyMetricResult);
deleteDailyMetricAdmin: (date: text) -> (NatResult);
getActivityFeed: (query: ActivityFeedQuery) -> (ActivityFeedResult) query;
getActivityFeedCacheStatus: () -> (ActivityFeedCacheStatusResult) query;
getAdminRoles: () -> (AdminRoleAssignmentsResult) query;
getDailyMetricByDate: (date: text) -> (DailyMetricResult) query;
getDailyMetrics: (dailyMetricsQuery: opt DailyMetricsQuery) ->
Expand All @@ -228,6 +295,7 @@ type ApiCanister =
getLatestDailyMetric: () -> (DailyMetricResult) query;
getMasterCanisterId: () -> (AuthRecordResult) query;
getNumDailyMetrics: () -> (NatResult) query;
getOpenChallengesFromCache: () -> (OpenChallengesResult) query;
getTokenRewardsData: () -> (TokenRewardsDataResult) query;
health: () -> (StatusCodeRecordResult) query;
resetDailyMetricsAdmin: () -> (NatResult);
Expand Down
81 changes: 81 additions & 0 deletions src/declarations/api_canister/api_canister.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export interface ApiCanister {
>,
'createDailyMetricAdmin' : ActorMethod<[DailyMetricInput], DailyMetricResult>,
'deleteDailyMetricAdmin' : ActorMethod<[string], NatResult>,
'getActivityFeed' : ActorMethod<[ActivityFeedQuery], ActivityFeedResult>,
'getActivityFeedCacheStatus' : ActorMethod<[], CacheStatusResult>,
'getActivityFeedSyncIntervalAdmin' : ActorMethod<[], NatResult>,
'getAdminRoles' : ActorMethod<[], AdminRoleAssignmentsResult>,
'getDailyMetricByDate' : ActorMethod<[string], DailyMetricResult>,
'getDailyMetrics' : ActorMethod<
Expand All @@ -37,11 +40,15 @@ export interface ApiCanister {
'getLatestDailyMetric' : ActorMethod<[], DailyMetricResult>,
'getMasterCanisterId' : ActorMethod<[], AuthRecordResult>,
'getNumDailyMetrics' : ActorMethod<[], NatResult>,
'getOpenChallengesFromCache' : ActorMethod<[], ChallengesResult>,
'getTokenRewardsData' : ActorMethod<[], TokenRewardsDataResult>,
'health' : ActorMethod<[], StatusCodeRecordResult>,
'resetDailyMetricsAdmin' : ActorMethod<[], NatResult>,
'revokeAdminRole' : ActorMethod<[string], TextResult>,
'setActivityFeedSyncIntervalAdmin' : ActorMethod<[bigint], StatusCodeRecordResult>,
'setMasterCanisterId' : ActorMethod<[string], AuthRecordResult>,
'startActivityFeedTimerAdmin' : ActorMethod<[], AuthRecordResult>,
'stopActivityFeedTimerAdmin' : ActorMethod<[], AuthRecordResult>,
'updateDailyMetricAdmin' : ActorMethod<
[UpdateDailyMetricAdminInput],
DailyMetricResult
Expand All @@ -55,6 +62,80 @@ export type ApiError = { 'FailedOperation' : null } |
{ 'StatusCode' : StatusCode } |
{ 'Other' : string } |
{ 'InsuffientCycles' : bigint };

// Activity Feed Types
export interface ActivityFeedQuery {
'winnersLimit' : [] | [bigint],
'winnersOffset' : [] | [bigint],
'challengesLimit' : [] | [bigint],
'challengesOffset' : [] | [bigint],
'sinceTimestamp' : [] | [bigint],
}
export interface ChallengeParticipantEntry {
'submissionId' : string,
'submittedBy' : Principal,
'ownedBy' : Principal,
'result' : ChallengeParticipationResult,
'reward' : ChallengeWinnerReward,
}
export type ChallengeParticipationResult = { 'Winner' : null } |
{ 'SecondPlace' : null } |
{ 'ThirdPlace' : null } |
{ 'Participated' : null } |
{ 'Other' : string };
export interface ChallengeWinnerReward {
'amount' : bigint,
'rewardType' : RewardType,
'rewardDetails' : string,
'distributed' : boolean,
'distributedTimestamp' : [] | [bigint],
}
export type RewardType = { 'MainerToken' : null } |
{ 'Cycles' : null } |
{ 'ICP' : null } |
{ 'Coupon' : string } |
{ 'Other' : string };
export interface ChallengeWinnerDeclarationArray {
'challengeId' : string,
'finalizedTimestamp' : bigint,
'winner' : ChallengeParticipantEntry,
'secondPlace' : ChallengeParticipantEntry,
'thirdPlace' : ChallengeParticipantEntry,
'participants' : Array<ChallengeParticipantEntry>,
}
export type ChallengeStatus = { 'Open' : null } |
{ 'Closed' : null } |
{ 'Archived' : null } |
{ 'Other' : string };
export interface Challenge {
'challengeId' : string,
'challengeQuestion' : string,
'challengeTopic' : string,
'challengeCreationTimestamp' : bigint,
'challengeCreatedBy' : string,
'challengeStatus' : ChallengeStatus,
'challengeClosedTimestamp' : [] | [bigint],
}
export interface ActivityFeedResponse {
'winners' : Array<ChallengeWinnerDeclarationArray>,
'challenges' : Array<Challenge>,
'totalWinners' : bigint,
'totalChallenges' : bigint,
'cacheTimestamp' : bigint,
}
export type ActivityFeedResult = { 'Ok' : ActivityFeedResponse } |
{ 'Err' : ApiError };
export interface CacheStatus {
'lastSyncTimestamp' : bigint,
'cachedWinnersCount' : bigint,
'cachedChallengesCount' : bigint,
'syncIntervalSeconds' : bigint,
}
export type CacheStatusResult = { 'Ok' : CacheStatus } |
{ 'Err' : ApiError };
export type ChallengesResult = { 'Ok' : Array<Challenge> } |
{ 'Err' : ApiError };

export interface AssignAdminRoleInputRecord {
'principal' : string,
'note' : string,
Expand Down
93 changes: 93 additions & 0 deletions src/declarations/api_canister/api_canister.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,92 @@ export const idlFactory = ({ IDL }) => {
'Ok' : DailyMetric,
'Err' : ApiError,
});

// Activity Feed Types
const ActivityFeedQuery = IDL.Record({
'winnersLimit' : IDL.Opt(IDL.Nat),
'winnersOffset' : IDL.Opt(IDL.Nat),
'challengesLimit' : IDL.Opt(IDL.Nat),
'challengesOffset' : IDL.Opt(IDL.Nat),
'sinceTimestamp' : IDL.Opt(IDL.Nat64),
});
const ChallengeParticipationResult = IDL.Variant({
'Winner' : IDL.Null,
'SecondPlace' : IDL.Null,
'ThirdPlace' : IDL.Null,
'Participated' : IDL.Null,
'Other' : IDL.Text,
});
const RewardType = IDL.Variant({
'MainerToken' : IDL.Null,
'Cycles' : IDL.Null,
'ICP' : IDL.Null,
'Coupon' : IDL.Text,
'Other' : IDL.Text,
});
const ChallengeWinnerReward = IDL.Record({
'amount' : IDL.Nat,
'rewardType' : RewardType,
'rewardDetails' : IDL.Text,
'distributed' : IDL.Bool,
'distributedTimestamp' : IDL.Opt(IDL.Nat64),
});
const ChallengeParticipantEntry = IDL.Record({
'submissionId' : IDL.Text,
'submittedBy' : IDL.Principal,
'ownedBy' : IDL.Principal,
'result' : ChallengeParticipationResult,
'reward' : ChallengeWinnerReward,
});
const ChallengeWinnerDeclarationArray = IDL.Record({
'challengeId' : IDL.Text,
'finalizedTimestamp' : IDL.Nat64,
'winner' : ChallengeParticipantEntry,
'secondPlace' : ChallengeParticipantEntry,
'thirdPlace' : ChallengeParticipantEntry,
'participants' : IDL.Vec(ChallengeParticipantEntry),
});
const ChallengeStatus = IDL.Variant({
'Open' : IDL.Null,
'Closed' : IDL.Null,
'Archived' : IDL.Null,
'Other' : IDL.Text,
});
const Challenge = IDL.Record({
'challengeId' : IDL.Text,
'challengeQuestion' : IDL.Text,
'challengeTopic' : IDL.Text,
'challengeCreationTimestamp' : IDL.Nat64,
'challengeCreatedBy' : IDL.Text,
'challengeStatus' : ChallengeStatus,
'challengeClosedTimestamp' : IDL.Opt(IDL.Nat64),
});
const ActivityFeedResponse = IDL.Record({
'winners' : IDL.Vec(ChallengeWinnerDeclarationArray),
'challenges' : IDL.Vec(Challenge),
'totalWinners' : IDL.Nat,
'totalChallenges' : IDL.Nat,
'cacheTimestamp' : IDL.Nat64,
});
const ActivityFeedResult = IDL.Variant({
'Ok' : ActivityFeedResponse,
'Err' : ApiError,
});
const CacheStatus = IDL.Record({
'lastSyncTimestamp' : IDL.Nat64,
'cachedWinnersCount' : IDL.Nat,
'cachedChallengesCount' : IDL.Nat,
'syncIntervalSeconds' : IDL.Nat,
});
const CacheStatusResult = IDL.Variant({
'Ok' : CacheStatus,
'Err' : ApiError,
});
const ChallengesResult = IDL.Variant({
'Ok' : IDL.Vec(Challenge),
'Err' : ApiError,
});

const AdminRoleAssignmentsResult = IDL.Variant({
'Ok' : IDL.Vec(AdminRoleAssignment),
'Err' : ApiError,
Expand Down Expand Up @@ -209,6 +295,9 @@ export const idlFactory = ({ IDL }) => {
[],
),
'deleteDailyMetricAdmin' : IDL.Func([IDL.Text], [NatResult], []),
'getActivityFeed' : IDL.Func([ActivityFeedQuery], [ActivityFeedResult], ['query']),
'getActivityFeedCacheStatus' : IDL.Func([], [CacheStatusResult], ['query']),
'getActivityFeedSyncIntervalAdmin' : IDL.Func([], [NatResult], ['query']),
'getAdminRoles' : IDL.Func([], [AdminRoleAssignmentsResult], ['query']),
'getDailyMetricByDate' : IDL.Func(
[IDL.Text],
Expand All @@ -224,11 +313,15 @@ export const idlFactory = ({ IDL }) => {
'getLatestDailyMetric' : IDL.Func([], [DailyMetricResult], ['query']),
'getMasterCanisterId' : IDL.Func([], [AuthRecordResult], ['query']),
'getNumDailyMetrics' : IDL.Func([], [NatResult], ['query']),
'getOpenChallengesFromCache' : IDL.Func([], [ChallengesResult], ['query']),
'getTokenRewardsData' : IDL.Func([], [TokenRewardsDataResult], ['query']),
'health' : IDL.Func([], [StatusCodeRecordResult], ['query']),
'resetDailyMetricsAdmin' : IDL.Func([], [NatResult], []),
'revokeAdminRole' : IDL.Func([IDL.Text], [TextResult], []),
'setActivityFeedSyncIntervalAdmin' : IDL.Func([IDL.Nat], [StatusCodeRecordResult], []),
'setMasterCanisterId' : IDL.Func([IDL.Text], [AuthRecordResult], []),
'startActivityFeedTimerAdmin' : IDL.Func([], [AuthRecordResult], []),
'stopActivityFeedTimerAdmin' : IDL.Func([], [AuthRecordResult], []),
'updateDailyMetricAdmin' : IDL.Func(
[UpdateDailyMetricAdminInput],
[DailyMetricResult],
Expand Down
Loading