Gifts

API: Internal/Stable

Gifts provide the system a way to grant new and existing users (personal projects) credits from a project

Rationale

The gifting system is primarily intended to provide credits to new users when they join the system. A Gift follows the same rules as Wallets do. This means that in order to give a gift to someone you must transfer the resources from a project. This means that the credits will be subtracted directly from the source project.

A Gift can only be claimed once by every user and it will be applied directly to the user’s personal project. Clients used by the end-user should use Gifts.availableGifts to figure out which Gifts are unclaimed by this user. It may then claim the individual Gifts with Gifts.claimGift.

Administrators of a project can manage Gifts through the Gifts.createGift, Gifts.deleteGift and Gifts.listGifts endpoints.


⚠️ WARNING: The API listed on this page will likely change to conform with our API conventions. Be careful when building integrations. The following changes are expected:

  • RPC names will change to conform with the conventions

  • RPC request and response types will change to conform with the conventions

  • RPCs which return a page will be collapsed into a single browse endpoint

  • Some property names will change to be consistent with Resources


Table of Contents

1. Remote Procedure Calls
Name Description
availableGifts Finds a list of a user's unclaimed `Gift`s
claimGift Claims a `Gift` to the calling user's personal project
createGift Creates a new Gift in the system
deleteGift Deletes a Gift by its DeleteGiftRequest.giftId
2. Data Models
Name Description
GiftWithCriteria A `Gift` along with the `criteria` for which that can `Gifts.claimGift` this
ClaimGiftRequest No description
DeleteGiftRequest No description
AvailableGiftsResponse No description

Remote Procedure Calls

availableGifts

API: Internal/Stable Auth: Users

Finds a list of a user’s unclaimed Gifts

Request Response Error
Unit AvailableGiftsResponse CommonErrorMessage

claimGift

API: Internal/Stable Auth: Users

Claims a Gift to the calling user’s personal project

Request Response Error
ClaimGiftRequest Unit CommonErrorMessage

User errors:

  • Users who are not eligible for claiming this Gift will receive an appropriate error code.

  • If the gifting project has run out of resources then this endpoint will fail. The gift will not be marked as claimed.

createGift

API: Internal/Stable Auth: Users

Creates a new Gift in the system

Request Response Error
GiftWithCriteria FindByLongId CommonErrorMessage

Only project administrators can create new Gifts in the system.

deleteGift

API: Internal/Stable Auth: Users

Deletes a Gift by its DeleteGiftRequest.giftId

Request Response Error
DeleteGiftRequest Unit CommonErrorMessage

Only project administrators of Gift.resourcesOwnedBy can delete the Gift.

Data Models

GiftWithCriteria

API: Internal/Stable

A Gift along with the criteria for which that can Gifts.claimGift this

data class GiftWithCriteria(
    val id: Long,
    val resourcesOwnedBy: String,
    val title: String,
    val description: String,
    val resources: List<GrantApplication.AllocationRequest>,
    val criteria: List<UserCriteria>,
)
Properties
id: Long
resourcesOwnedBy: String A reference to the project which owns these resources
title: String The title of a gift

Suitable for presentation in UIs

description: String The title of a gift

Suitable for presentation in UIs

resources: List<GrantApplication.AllocationRequest> A list of resources which will be granted to users `Gifts.claimGift` this `Gift`.
criteria: List<UserCriteria>

ClaimGiftRequest

API: Internal/Stable

data class ClaimGiftRequest(
    val giftId: Long,
)
Properties
giftId: Long

DeleteGiftRequest

API: Internal/Stable

data class DeleteGiftRequest(
    val giftId: Long,
)
Properties
giftId: Long

AvailableGiftsResponse

API: Internal/Stable

data class AvailableGiftsResponse(
    val gifts: List<FindByLongId>,
)
Properties
gifts: List<FindByLongId>