Compare commits
No commits in common. "f77af25b844abb8124aabb1048fce37be8d4e8b3" and "afb3d7fa3d758c966d3dbdab59c3c63a5c426536" have entirely different histories.
f77af25b84
...
afb3d7fa3d
|
@ -18,12 +18,12 @@ import {CustomClientOptions, optionsToConfig} from "./utils/options.js";
|
||||||
import { throwValidationError } from "./utils/validation.js";
|
import { throwValidationError } from "./utils/validation.js";
|
||||||
import {
|
import {
|
||||||
AccountPinsResponse,
|
AccountPinsResponse,
|
||||||
BasicUploadResponse, deleteS5DeleteCid,
|
BasicUploadResponse,
|
||||||
getS5AccountPins,
|
getS5AccountPins,
|
||||||
getS5BlobCid,
|
getS5BlobCid,
|
||||||
getS5DownloadCid,
|
getS5DownloadCid,
|
||||||
getS5MetadataCid, getS5PinCidStatus,
|
getS5MetadataCid,
|
||||||
getS5Registry, postS5PinCid,
|
getS5Registry,
|
||||||
postS5Registry,
|
postS5Registry,
|
||||||
postS5Upload,
|
postS5Upload,
|
||||||
postS5UploadDirectory,
|
postS5UploadDirectory,
|
||||||
|
@ -69,7 +69,6 @@ import defer from "p-defer";
|
||||||
import { Multihash } from "@lumeweb/libs5/lib/multihash.js";
|
import { Multihash } from "@lumeweb/libs5/lib/multihash.js";
|
||||||
import { blake3 } from "@noble/hashes/blake3";
|
import { blake3 } from "@noble/hashes/blake3";
|
||||||
import { base64urlDecode, base64urlEncode } from "./utils/encoding.js";
|
import { base64urlDecode, base64urlEncode } from "./utils/encoding.js";
|
||||||
import {CustomPinOptions, DEFAULT_PIN_OPTIONS} from "#options/pin.js";
|
|
||||||
|
|
||||||
export class S5Error extends Error {
|
export class S5Error extends Error {
|
||||||
public statusCode: number;
|
public statusCode: number;
|
||||||
|
@ -728,34 +727,4 @@ export class S5Client {
|
||||||
|
|
||||||
return p.promise;
|
return p.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async pin(cid: string, customOptions: CustomPinOptions = {}) {
|
|
||||||
const config = optionsToConfig(
|
|
||||||
this,
|
|
||||||
DEFAULT_PIN_OPTIONS,
|
|
||||||
customOptions,
|
|
||||||
);
|
|
||||||
|
|
||||||
await postS5PinCid(cid, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async unpin(cid: string, customOptions: CustomPinOptions = {}) {
|
|
||||||
const config = optionsToConfig(
|
|
||||||
this,
|
|
||||||
DEFAULT_PIN_OPTIONS,
|
|
||||||
customOptions,
|
|
||||||
);
|
|
||||||
|
|
||||||
await deleteS5DeleteCid(cid, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async pinStatus(cid: string, customOptions: CustomPinOptions = {}) {
|
|
||||||
const config = optionsToConfig(
|
|
||||||
this,
|
|
||||||
DEFAULT_PIN_OPTIONS,
|
|
||||||
customOptions,
|
|
||||||
);
|
|
||||||
|
|
||||||
return await getS5PinCidStatus(cid, config);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import {CustomClientOptions} from "#utils/options.js";
|
|
||||||
import {ResponseType} from "axios";
|
|
||||||
|
|
||||||
export type CustomPinOptions = CustomClientOptions & {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DEFAULT_PIN_OPTIONS = {};
|
|
28
swagger.yaml
28
swagger.yaml
|
@ -679,24 +679,6 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
'204':
|
'204':
|
||||||
description: File pinned
|
description: File pinned
|
||||||
/s5/pin/{cid}/status:
|
|
||||||
get:
|
|
||||||
summary: Retrieve pin status
|
|
||||||
tags:
|
|
||||||
- pin
|
|
||||||
parameters:
|
|
||||||
- name: cid
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Pin status
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/AccountPinStatusResponse'
|
|
||||||
/s5/delete/{cid}:
|
/s5/delete/{cid}:
|
||||||
delete:
|
delete:
|
||||||
summary: Delete a file. This will only unpin it from the account, and potentially delete it later if there are no more global pins.
|
summary: Delete a file. This will only unpin it from the account, and potentially delete it later if there are no more global pins.
|
||||||
|
@ -941,16 +923,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
AccountPinStatusResponse:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- status
|
|
||||||
- progress
|
|
||||||
properties:
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
progress:
|
|
||||||
type: number
|
|
||||||
RegistryQueryResponse:
|
RegistryQueryResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
Loading…
Reference in New Issue