feat!: @rudder/sdk 0.1.0: createClient, idempotent modules.call retries, storage save(type, data), drop resources and projectStorage
This commit is contained in:
@@ -4,8 +4,6 @@ import type { LinkViaAppleRequest, LinkViaCustomRequest, LinkViaGoogleRequest, L
|
||||
import type { ListCatalogCurrenciesResponse } from './catalog.js';
|
||||
import type { CallModuleFunctionClientResponse, CallModuleFunctionRequest } from './modules.js';
|
||||
import type { PlayerProfile } from './player.js';
|
||||
import type { GetProjectStorageResponse, UpdateProjectStorageRequest } from './project-storage.js';
|
||||
import type { CreateResourceRowRequest, ListResourceRowsResponse, ResourceRow, UpdateResourceRowRequest } from './resources.js';
|
||||
import type { GetStorageResponse, UpdateStorageRequest } from './storage.js';
|
||||
|
||||
/** The minimal transport contract the generated API functions call through. */
|
||||
@@ -38,19 +36,6 @@ export const api = {
|
||||
): Promise<CallModuleFunctionClientResponse> =>
|
||||
t.request<CallModuleFunctionClientResponse>('POST', `/sdk/v1/modules/${enc(path.module)}/${enc(path.fn)}`, body),
|
||||
|
||||
createResourceRow: (
|
||||
t: Transport,
|
||||
path: { slug: string },
|
||||
body: CreateResourceRowRequest,
|
||||
): Promise<ResourceRow> =>
|
||||
t.request<ResourceRow>('POST', `/sdk/v1/resources/${enc(path.slug)}`, body),
|
||||
|
||||
deleteResourceRow: (
|
||||
t: Transport,
|
||||
path: { slug: string; id: string },
|
||||
): Promise<void> =>
|
||||
t.request<void>('DELETE', `/sdk/v1/resources/${enc(path.slug)}/${enc(path.id)}`),
|
||||
|
||||
deleteStorage: (
|
||||
t: Transport,
|
||||
query?: { type?: string },
|
||||
@@ -62,18 +47,6 @@ export const api = {
|
||||
): Promise<PlayerProfile> =>
|
||||
t.request<PlayerProfile>('GET', '/sdk/v1/player/information'),
|
||||
|
||||
getProjectStorage: (
|
||||
t: Transport,
|
||||
query?: { types?: string; limit?: number; cursor?: string },
|
||||
): Promise<GetProjectStorageResponse> =>
|
||||
t.request<GetProjectStorageResponse>('GET', `/sdk/v1/project-storage${qs([['types', query?.types], ['limit', query?.limit], ['cursor', query?.cursor]])}`),
|
||||
|
||||
getResourceRow: (
|
||||
t: Transport,
|
||||
path: { slug: string; id: string },
|
||||
): Promise<ResourceRow> =>
|
||||
t.request<ResourceRow>('GET', `/sdk/v1/resources/${enc(path.slug)}/${enc(path.id)}`),
|
||||
|
||||
getRevisions: (
|
||||
t: Transport,
|
||||
): Promise<{ [key: string]: number }> =>
|
||||
@@ -108,13 +81,6 @@ export const api = {
|
||||
): Promise<ListCatalogCurrenciesResponse> =>
|
||||
t.request<ListCatalogCurrenciesResponse>('GET', '/sdk/v1/catalog'),
|
||||
|
||||
listResourceRows: (
|
||||
t: Transport,
|
||||
path: { slug: string },
|
||||
query?: { _q?: string; _sort?: string; _order?: string; _start?: number; _end?: number },
|
||||
): Promise<ListResourceRowsResponse> =>
|
||||
t.request<ListResourceRowsResponse>('GET', `/sdk/v1/resources/${enc(path.slug)}${qs([['_q', query?._q], ['_sort', query?._sort], ['_order', query?._order], ['_start', query?._start], ['_end', query?._end]])}`),
|
||||
|
||||
loginViaApple: (
|
||||
t: Transport,
|
||||
body: LoginViaAppleRequest,
|
||||
@@ -151,19 +117,6 @@ export const api = {
|
||||
): Promise<void> =>
|
||||
t.request<void>('POST', '/sdk/v1/authorization/unlink', body),
|
||||
|
||||
updateProjectStorage: (
|
||||
t: Transport,
|
||||
body: UpdateProjectStorageRequest,
|
||||
): Promise<void> =>
|
||||
t.request<void>('PUT', '/sdk/v1/project-storage', body),
|
||||
|
||||
updateResourceRow: (
|
||||
t: Transport,
|
||||
path: { slug: string; id: string },
|
||||
body: UpdateResourceRowRequest,
|
||||
): Promise<ResourceRow> =>
|
||||
t.request<ResourceRow>('PATCH', `/sdk/v1/resources/${enc(path.slug)}/${enc(path.id)}`, body),
|
||||
|
||||
updateStorage: (
|
||||
t: Transport,
|
||||
body: UpdateStorageRequest,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Code generated by apigen. DO NOT EDIT.
|
||||
|
||||
import type { ResourceRowUsage } from './resources.js';
|
||||
import type { ResourceRowUsage } from './modules.js';
|
||||
|
||||
export interface ErrorResponse {
|
||||
"code"?: "forbidden" | "row_referenced";
|
||||
"code"?: "forbidden" | "idempotency_key_mismatch" | "row_referenced";
|
||||
"error"?: string;
|
||||
"index"?: number;
|
||||
"path"?: string;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Code generated by apigen. DO NOT EDIT.
|
||||
|
||||
export type RudderErrorCode = "forbidden" | "row_referenced";
|
||||
export type RudderErrorCode = "forbidden" | "idempotency_key_mismatch" | "row_referenced";
|
||||
|
||||
export const RudderErrorCodes = {
|
||||
forbidden: "forbidden",
|
||||
idempotencyKeyMismatch: "idempotency_key_mismatch",
|
||||
rowReferenced: "row_referenced",
|
||||
} as const;
|
||||
|
||||
@@ -5,8 +5,6 @@ export * from './catalog.js';
|
||||
export * from './common.js';
|
||||
export * from './modules.js';
|
||||
export * from './player.js';
|
||||
export * from './project-storage.js';
|
||||
export * from './resources.js';
|
||||
export * from './storage.js';
|
||||
export * from './api.js';
|
||||
export * from './errors.js';
|
||||
|
||||
@@ -15,3 +15,10 @@ export interface ModuleErrorResponse {
|
||||
"requestId"?: string;
|
||||
}
|
||||
|
||||
export interface ResourceRowUsage {
|
||||
"definitionSlug"?: string;
|
||||
"field"?: string;
|
||||
"moduleSlug"?: string;
|
||||
"rowId"?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface Player {
|
||||
}
|
||||
|
||||
export interface PlayerProfile {
|
||||
"counters"?: { [key: string]: number };
|
||||
"identities"?: PlayerProfileIdentity[];
|
||||
"player"?: Player;
|
||||
"wallets"?: Wallet[];
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// Code generated by apigen. DO NOT EDIT.
|
||||
|
||||
export interface GetProjectStorageResponse {
|
||||
"items"?: ProjectStorageItem[];
|
||||
"nextCursor"?: string;
|
||||
}
|
||||
|
||||
export interface ProjectStorageItem {
|
||||
"data"?: string;
|
||||
"expiresAt"?: string;
|
||||
"id"?: string;
|
||||
"readPermission"?: "public" | "serverOnly";
|
||||
"size"?: number;
|
||||
"type"?: string;
|
||||
"updatedAt"?: string;
|
||||
"version"?: number;
|
||||
"writePermission"?: "public" | "serverOnly";
|
||||
}
|
||||
|
||||
export interface ProjectStorageUpdateItem {
|
||||
"data"?: string;
|
||||
"type"?: string;
|
||||
}
|
||||
|
||||
export interface UpdateProjectStorageRequest {
|
||||
"idempotencyKey"?: string;
|
||||
"items"?: ProjectStorageUpdateItem[];
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// Code generated by apigen. DO NOT EDIT.
|
||||
|
||||
export interface CreateResourceRowRequest {
|
||||
"data"?: { [key: string]: unknown };
|
||||
"id"?: string;
|
||||
}
|
||||
|
||||
export interface ListResourceRowsResponse {
|
||||
"items"?: ResourceRow[];
|
||||
"total"?: number;
|
||||
}
|
||||
|
||||
export interface ResourceRow {
|
||||
"createdAt"?: string;
|
||||
"data"?: { [key: string]: unknown };
|
||||
"id"?: string;
|
||||
"playerId"?: string;
|
||||
"rank"?: number;
|
||||
"updatedAt"?: string;
|
||||
"version"?: number;
|
||||
}
|
||||
|
||||
export interface ResourceRowUsage {
|
||||
"definitionSlug"?: string;
|
||||
"field"?: string;
|
||||
"moduleSlug"?: string;
|
||||
"rowId"?: string;
|
||||
}
|
||||
|
||||
export interface UpdateResourceRowRequest {
|
||||
"data"?: { [key: string]: unknown };
|
||||
"version"?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user