Skip to content

Commit

Permalink
fix rsf headers (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue authored Aug 30, 2023
1 parent 9328d64 commit e8caec8
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 23 deletions.
31 changes: 31 additions & 0 deletions gtests/rsf_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <gtest/gtest.h>
#include "test.h"
#include "qiniu/rsf.h"

TEST(IntegrationTest, TestRsfListFiles)
{
Qiniu_Client client;
Qiniu_Error err;
Qiniu_RSF_ListRet listRet;
Qiniu_Zero(listRet);
int totalCount = 0;

Qiniu_Client_InitMacAuth(&client, 1024, NULL);
Qiniu_Client_SetTimeout(&client, 5000);
Qiniu_Client_SetConnectTimeout(&client, 3000);
Qiniu_Client_EnableAutoQuery(&client, Qiniu_True);

do
{
err = Qiniu_RSF_ListFiles(&client, &listRet, Test_bucket, "", "", listRet.marker, 1000);
EXPECT_EQ(err.code, 200);
for (int i = 0; i < listRet.itemsCount; i++)
{
printf("%s\n", listRet.items[i].key);
}
totalCount += listRet.itemsCount;
} while (listRet.marker != NULL);
EXPECT_GT(totalCount, 0);

Qiniu_Client_Cleanup(&client);
}
58 changes: 35 additions & 23 deletions qiniu/rsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@

#include "http.h"

typedef struct _Qiniu_RSF_ListItem {
const char *key;
const char *hash;
const char *mimeType;
const char *endUser;
Qiniu_Int64 fsize;
Qiniu_Int64 putTime;
Qiniu_Int64 type;
} Qiniu_RSF_ListItem;

typedef struct _Qiniu_RSF_ListRet {
const char *marker;
char **commonPrefixes;
int commonPrefixesCount;
struct _Qiniu_RSF_ListItem *items;
int itemsCount;
} Qiniu_RSF_ListRet;

QINIU_DLLAPI extern Qiniu_Error Qiniu_RSF_ListFiles(Qiniu_Client *self, Qiniu_RSF_ListRet *ret, const char *bucket,
const char *prefix, const char *delimiter, const char *marker,
int limit);

#endif //PROJECT_RSF_H
#pragma pack(1)

#ifdef __cplusplus
extern "C"
{
#endif
typedef struct _Qiniu_RSF_ListItem
{
const char *key;
const char *hash;
const char *mimeType;
const char *endUser;
Qiniu_Int64 fsize;
Qiniu_Int64 putTime;
Qiniu_Int64 type;
} Qiniu_RSF_ListItem;

typedef struct _Qiniu_RSF_ListRet
{
const char *marker;
char **commonPrefixes;
int commonPrefixesCount;
struct _Qiniu_RSF_ListItem *items;
int itemsCount;
} Qiniu_RSF_ListRet;

QINIU_DLLAPI extern Qiniu_Error Qiniu_RSF_ListFiles(Qiniu_Client *self, Qiniu_RSF_ListRet *ret, const char *bucket,
const char *prefix, const char *delimiter, const char *marker,
int limit);
#pragma pack()

#ifdef __cplusplus
}
#endif

#endif // PROJECT_RSF_H

0 comments on commit e8caec8

Please sign in to comment.